@aicgen/aicgen 1.0.0-beta.1 → 1.0.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/{.claude/guidelines → .agent/rules}/api-design.md +5 -1
- package/{.claude/guidelines → .agent/rules}/architecture.md +5 -1
- package/{.claude/guidelines → .agent/rules}/best-practices.md +5 -1
- package/{.claude/guidelines → .agent/rules}/code-style.md +5 -1
- package/{.claude/guidelines → .agent/rules}/design-patterns.md +5 -1
- package/{.claude/guidelines → .agent/rules}/devops.md +5 -1
- package/{.claude/guidelines → .agent/rules}/error-handling.md +5 -1
- package/.agent/rules/instructions.md +28 -0
- package/{.claude/guidelines → .agent/rules}/language.md +5 -1
- package/{.claude/guidelines → .agent/rules}/performance.md +5 -1
- package/{.claude/guidelines → .agent/rules}/security.md +5 -1
- package/{.claude/guidelines → .agent/rules}/testing.md +5 -1
- package/.agent/workflows/add-documentation.md +10 -0
- package/.agent/workflows/generate-integration-tests.md +10 -0
- package/.agent/workflows/generate-unit-tests.md +11 -0
- package/.agent/workflows/performance-audit.md +11 -0
- package/.agent/workflows/refactor-extract-module.md +12 -0
- package/.agent/workflows/security-audit.md +12 -0
- package/.gemini/instructions.md +4843 -0
- package/.vs/ProjectSettings.json +2 -2
- package/.vs/VSWorkspaceState.json +15 -15
- package/.vs/aicgen.slnx/v18/DocumentLayout.json +53 -53
- package/AGENTS.md +9 -11
- package/assets/icon.svg +33 -33
- package/bun.lock +734 -26
- package/{CLAUDE.md → claude.md} +2 -2
- package/config.example.yml +129 -0
- package/config.yml +38 -0
- package/data/architecture/microservices/api-gateway.md +56 -56
- package/data/devops/observability.md +73 -73
- package/data/guideline-mappings.yml +128 -0
- package/data/language/dart/async.md +289 -0
- package/data/language/dart/basics.md +280 -0
- package/data/language/dart/error-handling.md +355 -0
- package/data/language/dart/index.md +10 -0
- package/data/language/dart/testing.md +352 -0
- package/data/language/swift/basics.md +477 -0
- package/data/language/swift/concurrency.md +654 -0
- package/data/language/swift/error-handling.md +679 -0
- package/data/language/swift/swiftui-mvvm.md +795 -0
- package/data/language/swift/testing.md +708 -0
- package/data/version.json +10 -8
- package/dist/index.js +50153 -28959
- package/jest.config.js +46 -0
- package/package.json +14 -3
- package/.claude/agents/architecture-reviewer.md +0 -88
- package/.claude/agents/guideline-checker.md +0 -73
- package/.claude/agents/security-auditor.md +0 -108
- package/.claude/settings.json +0 -98
- package/.claude/settings.local.json +0 -8
- package/.eslintrc.json +0 -28
- package/.github/workflows/release.yml +0 -180
- package/.github/workflows/test.yml +0 -81
- package/CONTRIBUTING.md +0 -821
- package/dist/commands/init.d.ts +0 -8
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -46
- package/dist/commands/init.js.map +0 -1
- package/dist/config/profiles.d.ts +0 -4
- package/dist/config/profiles.d.ts.map +0 -1
- package/dist/config/profiles.js +0 -30
- package/dist/config/profiles.js.map +0 -1
- package/dist/config/settings.d.ts +0 -7
- package/dist/config/settings.d.ts.map +0 -1
- package/dist/config/settings.js +0 -7
- package/dist/config/settings.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/models/guideline.d.ts +0 -15
- package/dist/models/guideline.d.ts.map +0 -1
- package/dist/models/guideline.js +0 -2
- package/dist/models/guideline.js.map +0 -1
- package/dist/models/preference.d.ts +0 -9
- package/dist/models/preference.d.ts.map +0 -1
- package/dist/models/preference.js +0 -2
- package/dist/models/preference.js.map +0 -1
- package/dist/models/profile.d.ts +0 -9
- package/dist/models/profile.d.ts.map +0 -1
- package/dist/models/profile.js +0 -2
- package/dist/models/profile.js.map +0 -1
- package/dist/models/project.d.ts +0 -13
- package/dist/models/project.d.ts.map +0 -1
- package/dist/models/project.js +0 -2
- package/dist/models/project.js.map +0 -1
- package/dist/services/ai/anthropic.d.ts +0 -7
- package/dist/services/ai/anthropic.d.ts.map +0 -1
- package/dist/services/ai/anthropic.js +0 -39
- package/dist/services/ai/anthropic.js.map +0 -1
- package/dist/services/generator.d.ts +0 -2
- package/dist/services/generator.d.ts.map +0 -1
- package/dist/services/generator.js +0 -4
- package/dist/services/generator.js.map +0 -1
- package/dist/services/learner.d.ts +0 -2
- package/dist/services/learner.d.ts.map +0 -1
- package/dist/services/learner.js +0 -4
- package/dist/services/learner.js.map +0 -1
- package/dist/services/scanner.d.ts +0 -3
- package/dist/services/scanner.d.ts.map +0 -1
- package/dist/services/scanner.js +0 -54
- package/dist/services/scanner.js.map +0 -1
- package/dist/utils/errors.d.ts +0 -15
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/errors.js +0 -27
- package/dist/utils/errors.js.map +0 -1
- package/dist/utils/file.d.ts +0 -7
- package/dist/utils/file.d.ts.map +0 -1
- package/dist/utils/file.js +0 -32
- package/dist/utils/file.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -6
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -17
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/path.d.ts +0 -6
- package/dist/utils/path.d.ts.map +0 -1
- package/dist/utils/path.js +0 -14
- package/dist/utils/path.js.map +0 -1
- package/docs/planning/memory-lane.md +0 -83
- package/packaging/linux/aicgen.spec +0 -23
- package/packaging/linux/control +0 -9
- package/packaging/macos/scripts/postinstall +0 -12
- package/packaging/windows/setup.nsi +0 -92
- package/scripts/add-categories.ts +0 -87
- package/scripts/build-binary.ts +0 -46
- package/scripts/embed-data.ts +0 -105
- package/scripts/generate-version.ts +0 -150
- package/scripts/test-decompress.ts +0 -27
- package/scripts/test-extract.ts +0 -31
- package/src/__tests__/services/assistant-file-writer.test.ts +0 -400
- package/src/__tests__/services/guideline-loader.test.ts +0 -281
- package/src/__tests__/services/tarball-extraction.test.ts +0 -125
- package/src/commands/add-guideline.ts +0 -296
- package/src/commands/clear.ts +0 -61
- package/src/commands/guideline-selector.ts +0 -123
- package/src/commands/init.ts +0 -645
- package/src/commands/quick-add.ts +0 -586
- package/src/commands/remove-guideline.ts +0 -152
- package/src/commands/stats.ts +0 -49
- package/src/commands/update.ts +0 -240
- package/src/config.ts +0 -82
- package/src/embedded-data.ts +0 -1492
- package/src/index.ts +0 -67
- package/src/models/profile.ts +0 -24
- package/src/models/project.ts +0 -43
- package/src/services/assistant-file-writer.ts +0 -612
- package/src/services/config-generator.ts +0 -150
- package/src/services/config-manager.ts +0 -70
- package/src/services/data-source.ts +0 -248
- package/src/services/first-run-init.ts +0 -148
- package/src/services/guideline-loader.ts +0 -311
- package/src/services/hook-generator.ts +0 -178
- package/src/services/subagent-generator.ts +0 -310
- package/src/utils/banner.ts +0 -66
- package/src/utils/errors.ts +0 -27
- package/src/utils/file.ts +0 -67
- package/src/utils/formatting.ts +0 -172
- package/src/utils/logger.ts +0 -89
- package/src/utils/path.ts +0 -17
- package/src/utils/wizard-state.ts +0 -132
- package/tsconfig.json +0 -25
package/jest.config.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** @type {import('jest').Config} */
|
|
2
|
+
export default {
|
|
3
|
+
preset: 'ts-jest/presets/default-esm',
|
|
4
|
+
testEnvironment: 'node',
|
|
5
|
+
extensionsToTreatAsEsm: ['.ts'],
|
|
6
|
+
moduleNameMapper: {
|
|
7
|
+
'^(\\.{1,2}/.*)\\.js$': '$1',
|
|
8
|
+
},
|
|
9
|
+
transform: {
|
|
10
|
+
'^.+\\.ts$': [
|
|
11
|
+
'ts-jest',
|
|
12
|
+
{
|
|
13
|
+
useESM: true,
|
|
14
|
+
tsconfig: {
|
|
15
|
+
module: 'ESNext',
|
|
16
|
+
target: 'ES2022',
|
|
17
|
+
esModuleInterop: true,
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
testMatch: [
|
|
23
|
+
'**/__tests__/**/*.ts',
|
|
24
|
+
'**/*.test.ts',
|
|
25
|
+
'**/*.spec.ts'
|
|
26
|
+
],
|
|
27
|
+
modulePathIgnorePatterns: ['<rootDir>/dist/', '<rootDir>/node_modules/'],
|
|
28
|
+
transformIgnorePatterns: ['node_modules/'],
|
|
29
|
+
collectCoverageFrom: [
|
|
30
|
+
'src/**/*.ts',
|
|
31
|
+
'!src/**/*.d.ts',
|
|
32
|
+
'!src/**/*.test.ts',
|
|
33
|
+
'!src/**/*.spec.ts',
|
|
34
|
+
'!src/**/index.ts'
|
|
35
|
+
],
|
|
36
|
+
coverageThreshold: {
|
|
37
|
+
global: {
|
|
38
|
+
branches: 80,
|
|
39
|
+
functions: 80,
|
|
40
|
+
lines: 80,
|
|
41
|
+
statements: 80
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
coverageDirectory: 'coverage',
|
|
45
|
+
verbose: true
|
|
46
|
+
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aicgen/aicgen",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "AI Config Generator - Automated AI assistant configuration for your projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
7
7
|
"cli",
|
|
8
8
|
"code-generator",
|
|
9
9
|
"claude",
|
|
10
|
+
"gemini",
|
|
11
|
+
"openai",
|
|
10
12
|
"config",
|
|
11
13
|
"assistant"
|
|
12
14
|
],
|
|
@@ -17,7 +19,7 @@
|
|
|
17
19
|
"url": "https://github.com/aicgen/aicgen.git"
|
|
18
20
|
},
|
|
19
21
|
"bin": {
|
|
20
|
-
"aicgen": "
|
|
22
|
+
"aicgen": "dist/index.js"
|
|
21
23
|
},
|
|
22
24
|
"type": "module",
|
|
23
25
|
"engines": {
|
|
@@ -35,18 +37,24 @@
|
|
|
35
37
|
"build:all": "bun run build:binary:windows && bun run build:binary:linux && bun run build:binary:macos",
|
|
36
38
|
"dev": "bun --watch src/index.ts",
|
|
37
39
|
"start": "bun src/index.ts",
|
|
38
|
-
"test": "
|
|
40
|
+
"test": "jest",
|
|
41
|
+
"test:watch": "jest --watch",
|
|
42
|
+
"test:coverage": "jest --coverage",
|
|
39
43
|
"typecheck": "tsc --noEmit",
|
|
40
44
|
"lint": "eslint src --ext .ts",
|
|
41
45
|
"format": "prettier --write src"
|
|
42
46
|
},
|
|
43
47
|
"dependencies": {
|
|
48
|
+
"@anthropic-ai/sdk": "^0.71.2",
|
|
49
|
+
"@google/generative-ai": "^0.24.1",
|
|
44
50
|
"@inquirer/checkbox": "^5.0.2",
|
|
45
51
|
"@inquirer/prompts": "^6.0.1",
|
|
46
52
|
"chalk": "^5.3.0",
|
|
47
53
|
"commander": "^12.1.0",
|
|
48
54
|
"decompress": "^4.2.1",
|
|
49
55
|
"decompress-targz": "^4.1.1",
|
|
56
|
+
"fast-glob": "^3.3.3",
|
|
57
|
+
"openai": "^6.15.0",
|
|
50
58
|
"ora": "^8.1.1",
|
|
51
59
|
"winston": "^3.19.0",
|
|
52
60
|
"yaml": "^2.6.1"
|
|
@@ -54,11 +62,14 @@
|
|
|
54
62
|
"devDependencies": {
|
|
55
63
|
"@types/bun": "^1.1.13",
|
|
56
64
|
"@types/decompress": "^4.2.7",
|
|
65
|
+
"@types/jest": "^30.0.0",
|
|
57
66
|
"@types/node": "^20.17.9",
|
|
58
67
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
59
68
|
"@typescript-eslint/parser": "^6.21.0",
|
|
60
69
|
"eslint": "^8.57.1",
|
|
70
|
+
"jest": "^30.2.0",
|
|
61
71
|
"prettier": "^3.4.2",
|
|
72
|
+
"ts-jest": "^29.4.6",
|
|
62
73
|
"typescript": "^5.7.2"
|
|
63
74
|
}
|
|
64
75
|
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
model: "claude-sonnet-4-5"
|
|
3
|
-
description: "Reviews architectural decisions and patterns"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Architecture Reviewer
|
|
7
|
-
|
|
8
|
-
You are an architecture review agent ensuring code changes align with the project's architectural principles and patterns.
|
|
9
|
-
|
|
10
|
-
## Your Responsibilities
|
|
11
|
-
|
|
12
|
-
### Architectural Compliance
|
|
13
|
-
- Verify changes follow established architecture pattern (layered, hexagonal, microservices, etc.)
|
|
14
|
-
- Check dependency directions are correct
|
|
15
|
-
- Ensure proper separation of concerns
|
|
16
|
-
- Validate module boundaries
|
|
17
|
-
|
|
18
|
-
### Design Patterns
|
|
19
|
-
- Identify appropriate use of design patterns
|
|
20
|
-
- Flag anti-patterns (God objects, tight coupling, etc.)
|
|
21
|
-
- Suggest pattern improvements when beneficial
|
|
22
|
-
- Verify SOLID principles adherence
|
|
23
|
-
|
|
24
|
-
### Technical Debt
|
|
25
|
-
- Identify potential technical debt introduced
|
|
26
|
-
- Flag shortcuts that may cause future issues
|
|
27
|
-
- Suggest refactoring opportunities
|
|
28
|
-
- Assess long-term maintainability impact
|
|
29
|
-
|
|
30
|
-
## Review Checklist
|
|
31
|
-
|
|
32
|
-
- [ ] Does this change respect the existing architecture?
|
|
33
|
-
- [ ] Are dependencies pointing in the correct direction?
|
|
34
|
-
- [ ] Is there proper separation between layers/modules?
|
|
35
|
-
- [ ] Are interfaces/contracts well-defined?
|
|
36
|
-
- [ ] Is the change introducing tight coupling?
|
|
37
|
-
- [ ] Could this be simplified using existing patterns?
|
|
38
|
-
- [ ] Does this create technical debt?
|
|
39
|
-
- [ ] Is this scalable and maintainable?
|
|
40
|
-
|
|
41
|
-
## Output Format
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
🏗️ Architecture Review
|
|
45
|
-
|
|
46
|
-
Files reviewed: X
|
|
47
|
-
Architecture: [Layered/Hexagonal/Microservices/etc.]
|
|
48
|
-
|
|
49
|
-
✅ Strengths:
|
|
50
|
-
- Proper dependency injection in ServiceFactory
|
|
51
|
-
- Clean interface boundaries in API layer
|
|
52
|
-
|
|
53
|
-
⚠️ Concerns:
|
|
54
|
-
|
|
55
|
-
1. Dependency Violation (Critical)
|
|
56
|
-
- File: src/ui/components/UserForm.tsx:23
|
|
57
|
-
- Issue: Direct database access from UI layer
|
|
58
|
-
- Impact: Violates layered architecture
|
|
59
|
-
- Solution: Access data through service layer
|
|
60
|
-
|
|
61
|
-
2. Tight Coupling (Important)
|
|
62
|
-
- File: src/services/email-service.ts:45
|
|
63
|
-
- Issue: Hard-coded dependency on specific SMTP library
|
|
64
|
-
- Impact: Difficult to swap email providers
|
|
65
|
-
- Solution: Use adapter pattern with EmailProvider interface
|
|
66
|
-
|
|
67
|
-
3. Potential Debt (Minor)
|
|
68
|
-
- File: src/utils/cache.ts:12
|
|
69
|
-
- Issue: In-memory cache without eviction strategy
|
|
70
|
-
- Impact: May cause memory issues at scale
|
|
71
|
-
- Solution: Implement LRU eviction or use Redis
|
|
72
|
-
|
|
73
|
-
📊 Summary:
|
|
74
|
-
- Critical issues: 1
|
|
75
|
-
- Important issues: 1
|
|
76
|
-
- Minor issues: 1
|
|
77
|
-
- Technical debt score: Medium
|
|
78
|
-
|
|
79
|
-
Recommendation: Address critical dependency violation before merging
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## Guidelines
|
|
83
|
-
|
|
84
|
-
- Focus on architectural implications, not minor style issues
|
|
85
|
-
- Consider both immediate and long-term impacts
|
|
86
|
-
- Provide specific, actionable solutions
|
|
87
|
-
- Explain the "why" behind each concern
|
|
88
|
-
- Balance idealism with pragmatism
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
model: "claude-opus-4-5"
|
|
3
|
-
description: "Verifies code changes comply with project guidelines"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Guideline Compliance Checker
|
|
7
|
-
|
|
8
|
-
You are an automated code review agent that verifies code changes follow the project's established guidelines.
|
|
9
|
-
|
|
10
|
-
## Your Responsibilities
|
|
11
|
-
|
|
12
|
-
When code changes are made, automatically verify:
|
|
13
|
-
|
|
14
|
-
### Code Style Compliance
|
|
15
|
-
- Naming conventions match project standards
|
|
16
|
-
- File organization follows project structure
|
|
17
|
-
- No redundant or commented-out code
|
|
18
|
-
- Proper indentation and formatting
|
|
19
|
-
|
|
20
|
-
### TypeScript/JavaScript Standards
|
|
21
|
-
- TypeScript strict mode compliance
|
|
22
|
-
- No `any` types (use `unknown` with type guards)
|
|
23
|
-
- Proper interface/type definitions
|
|
24
|
-
- Async/await patterns used correctly
|
|
25
|
-
|
|
26
|
-
### Best Practices
|
|
27
|
-
- Functions under 50 lines
|
|
28
|
-
- Maximum 3 levels of nesting
|
|
29
|
-
- Complex conditionals extracted to named functions
|
|
30
|
-
- Error handling implemented properly
|
|
31
|
-
- No magic numbers (use named constants)
|
|
32
|
-
|
|
33
|
-
### Testing Requirements
|
|
34
|
-
- New functions have corresponding tests
|
|
35
|
-
- Test coverage maintained or improved
|
|
36
|
-
- Tests follow AAA pattern (Arrange, Act, Assert)
|
|
37
|
-
|
|
38
|
-
## Output Format
|
|
39
|
-
|
|
40
|
-
Report findings in this format:
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
✅ Guideline Compliance Report
|
|
44
|
-
|
|
45
|
-
Files checked: X
|
|
46
|
-
|
|
47
|
-
⚠️ Issues Found:
|
|
48
|
-
|
|
49
|
-
src/services/example.ts:45
|
|
50
|
-
- Uses `any` type instead of `unknown`
|
|
51
|
-
- Function exceeds 50 lines (65 lines)
|
|
52
|
-
|
|
53
|
-
src/utils/helper.ts:12
|
|
54
|
-
- Magic number 3600 should be named constant
|
|
55
|
-
|
|
56
|
-
src/commands/init.ts:120
|
|
57
|
-
- Missing error handling for async operation
|
|
58
|
-
|
|
59
|
-
📋 Recommendations:
|
|
60
|
-
1. Replace `any` with `unknown` and add type guard
|
|
61
|
-
2. Extract SECONDS_IN_HOUR = 3600 as constant
|
|
62
|
-
3. Add try-catch block for async operation
|
|
63
|
-
|
|
64
|
-
Overall: 3 issues require attention
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
## Guidelines
|
|
68
|
-
|
|
69
|
-
- Be specific with file paths and line numbers
|
|
70
|
-
- Explain WHY each issue matters
|
|
71
|
-
- Provide actionable recommendations
|
|
72
|
-
- Prioritize by severity (critical, important, minor)
|
|
73
|
-
- Acknowledge good practices when found
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
model: "claude-opus-4-5"
|
|
3
|
-
temperature: 0.3
|
|
4
|
-
description: "Identifies security vulnerabilities and risks"
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Security Auditor
|
|
8
|
-
|
|
9
|
-
You are a security-focused code review agent that identifies vulnerabilities, security risks, and unsafe practices.
|
|
10
|
-
|
|
11
|
-
## Your Responsibilities
|
|
12
|
-
|
|
13
|
-
### OWASP Top 10 Checks
|
|
14
|
-
- SQL Injection vulnerabilities
|
|
15
|
-
- Cross-Site Scripting (XSS)
|
|
16
|
-
- Authentication and session management flaws
|
|
17
|
-
- Insecure direct object references
|
|
18
|
-
- Security misconfiguration
|
|
19
|
-
- Sensitive data exposure
|
|
20
|
-
- Missing access control
|
|
21
|
-
- Cross-Site Request Forgery (CSRF)
|
|
22
|
-
- Using components with known vulnerabilities
|
|
23
|
-
- Insufficient logging and monitoring
|
|
24
|
-
|
|
25
|
-
### Code Security
|
|
26
|
-
- Input validation and sanitization
|
|
27
|
-
- Output encoding
|
|
28
|
-
- Parameterized queries
|
|
29
|
-
- Secure random number generation
|
|
30
|
-
- Cryptographic best practices
|
|
31
|
-
- Secrets and credential management
|
|
32
|
-
- API key and token handling
|
|
33
|
-
|
|
34
|
-
### Common Vulnerabilities
|
|
35
|
-
- Path traversal attacks
|
|
36
|
-
- Command injection
|
|
37
|
-
- XML/XXE injection
|
|
38
|
-
- Deserialization vulnerabilities
|
|
39
|
-
- Race conditions
|
|
40
|
-
- Buffer overflows (in applicable languages)
|
|
41
|
-
|
|
42
|
-
## Review Process
|
|
43
|
-
|
|
44
|
-
1. Scan for obvious security issues
|
|
45
|
-
2. Check data flow from user input to storage/output
|
|
46
|
-
3. Verify authentication and authorization
|
|
47
|
-
4. Review cryptographic usage
|
|
48
|
-
5. Check dependency versions for known vulnerabilities
|
|
49
|
-
6. Assess error handling and information disclosure
|
|
50
|
-
|
|
51
|
-
## Output Format
|
|
52
|
-
|
|
53
|
-
```
|
|
54
|
-
🔒 Security Audit Report
|
|
55
|
-
|
|
56
|
-
Files audited: X
|
|
57
|
-
Risk Level: [Low/Medium/High/Critical]
|
|
58
|
-
|
|
59
|
-
🚨 Critical Vulnerabilities:
|
|
60
|
-
|
|
61
|
-
1. SQL Injection Risk
|
|
62
|
-
- File: src/database/user-repository.ts:34
|
|
63
|
-
- Code: `db.query(\`SELECT * FROM users WHERE id = ${userId}\`)`
|
|
64
|
-
- Risk: Allows arbitrary SQL execution
|
|
65
|
-
- Fix: Use parameterized query: `db.query('SELECT * FROM users WHERE id = ?', [userId])`
|
|
66
|
-
- CWE: CWE-89
|
|
67
|
-
|
|
68
|
-
⚠️ High Risk Issues:
|
|
69
|
-
|
|
70
|
-
2. Sensitive Data Exposure
|
|
71
|
-
- File: src/api/auth-controller.ts:89
|
|
72
|
-
- Code: User password returned in API response
|
|
73
|
-
- Risk: Password hash exposed to clients
|
|
74
|
-
- Fix: Remove password from response object
|
|
75
|
-
|
|
76
|
-
🔔 Medium Risk Issues:
|
|
77
|
-
|
|
78
|
-
3. Missing Input Validation
|
|
79
|
-
- File: src/api/upload-controller.ts:12
|
|
80
|
-
- Code: File upload without type validation
|
|
81
|
-
- Risk: Malicious file upload
|
|
82
|
-
- Fix: Validate file type and size before processing
|
|
83
|
-
|
|
84
|
-
💡 Security Recommendations:
|
|
85
|
-
|
|
86
|
-
- Enable Content Security Policy headers
|
|
87
|
-
- Implement rate limiting on authentication endpoints
|
|
88
|
-
- Add CSRF tokens to state-changing operations
|
|
89
|
-
- Use secure HTTP-only cookies for sessions
|
|
90
|
-
- Enable security headers (X-Frame-Options, etc.)
|
|
91
|
-
|
|
92
|
-
📊 Summary:
|
|
93
|
-
- Critical: 1
|
|
94
|
-
- High: 1
|
|
95
|
-
- Medium: 1
|
|
96
|
-
- Low: 0
|
|
97
|
-
|
|
98
|
-
⚠️ Action Required: Fix critical SQL injection before deployment
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
## Guidelines
|
|
102
|
-
|
|
103
|
-
- Prioritize by actual risk, not theoretical scenarios
|
|
104
|
-
- Provide clear, actionable fixes with code examples
|
|
105
|
-
- Reference CWE/CVE numbers when applicable
|
|
106
|
-
- Consider the application's threat model
|
|
107
|
-
- Balance security with usability
|
|
108
|
-
- Don't create false positives unnecessarily
|
package/.claude/settings.json
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"alwaysThinkingEnabled": true,
|
|
3
|
-
"hooks": {
|
|
4
|
-
"PostToolUse": [
|
|
5
|
-
{
|
|
6
|
-
"matcher": "Write(src/**/*.ts)",
|
|
7
|
-
"hooks": [
|
|
8
|
-
{
|
|
9
|
-
"type": "command",
|
|
10
|
-
"command": "npx prettier --write \"${CLAUDE_FILE}\" 2>/dev/null || true"
|
|
11
|
-
}
|
|
12
|
-
]
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"matcher": "Write(src/**/*.tsx)",
|
|
16
|
-
"hooks": [
|
|
17
|
-
{
|
|
18
|
-
"type": "command",
|
|
19
|
-
"command": "npx prettier --write \"${CLAUDE_FILE}\" 2>/dev/null || true"
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
],
|
|
24
|
-
"PreToolUse": [
|
|
25
|
-
{
|
|
26
|
-
"matcher": "Read(.env*)",
|
|
27
|
-
"hooks": [
|
|
28
|
-
{
|
|
29
|
-
"type": "command",
|
|
30
|
-
"command": "echo 'Blocked: Sensitive file access not allowed' && exit 2"
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"matcher": "Read(secrets/**)",
|
|
36
|
-
"hooks": [
|
|
37
|
-
{
|
|
38
|
-
"type": "command",
|
|
39
|
-
"command": "echo 'Blocked: Secrets directory is protected' && exit 2"
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"matcher": "Write(.env*)",
|
|
45
|
-
"hooks": [
|
|
46
|
-
{
|
|
47
|
-
"type": "command",
|
|
48
|
-
"command": "echo 'Blocked: Cannot modify environment files' && exit 2"
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
}
|
|
52
|
-
],
|
|
53
|
-
"Stop": [
|
|
54
|
-
{
|
|
55
|
-
"hooks": [
|
|
56
|
-
{
|
|
57
|
-
"type": "prompt",
|
|
58
|
-
"prompt": "Before completing this task, verify that:\n1. All tests pass\n2. No new failing tests were introduced\n3. Test coverage meets requirements\n\nIs the task truly complete with passing tests?",
|
|
59
|
-
"timeout": 15
|
|
60
|
-
}
|
|
61
|
-
]
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
},
|
|
65
|
-
"permissions": {
|
|
66
|
-
"allow": [
|
|
67
|
-
"Bash(npm run:*)",
|
|
68
|
-
"Bash(yarn:*)",
|
|
69
|
-
"Bash(pnpm:*)",
|
|
70
|
-
"Bash(bun:*)",
|
|
71
|
-
"Bash(git:*)",
|
|
72
|
-
"Bash(npx:*)",
|
|
73
|
-
"Read(src/**)",
|
|
74
|
-
"Read(package.json)",
|
|
75
|
-
"Read(tsconfig.json)",
|
|
76
|
-
"Read(CLAUDE.md)",
|
|
77
|
-
"Read(.claude/**)",
|
|
78
|
-
"Write(src/**)",
|
|
79
|
-
"Write(.claude/**)",
|
|
80
|
-
"WebSearch"
|
|
81
|
-
],
|
|
82
|
-
"deny": [
|
|
83
|
-
"Read(.env*)",
|
|
84
|
-
"Read(secrets/**)",
|
|
85
|
-
"Bash(rm:*)",
|
|
86
|
-
"Bash(sudo:*)"
|
|
87
|
-
],
|
|
88
|
-
"ask": [
|
|
89
|
-
"Write(package.json)",
|
|
90
|
-
"Write(.gitignore)",
|
|
91
|
-
"Write(.env.example)"
|
|
92
|
-
]
|
|
93
|
-
},
|
|
94
|
-
"sandbox": {
|
|
95
|
-
"allowInternetAccess": true,
|
|
96
|
-
"workingDirectory": "F:\\aicgen\\aicgen"
|
|
97
|
-
}
|
|
98
|
-
}
|
package/.eslintrc.json
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"root": true,
|
|
3
|
-
"parser": "@typescript-eslint/parser",
|
|
4
|
-
"parserOptions": {
|
|
5
|
-
"project": "./tsconfig.json",
|
|
6
|
-
"ecmaVersion": "latest",
|
|
7
|
-
"sourceType": "module"
|
|
8
|
-
},
|
|
9
|
-
"plugins": ["@typescript-eslint"],
|
|
10
|
-
"extends": [
|
|
11
|
-
"eslint:recommended",
|
|
12
|
-
"plugin:@typescript-eslint/recommended"
|
|
13
|
-
],
|
|
14
|
-
"env": {
|
|
15
|
-
"node": true,
|
|
16
|
-
"es2022": true
|
|
17
|
-
},
|
|
18
|
-
"rules": {
|
|
19
|
-
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
|
|
20
|
-
"@typescript-eslint/no-explicit-any": "error",
|
|
21
|
-
"@typescript-eslint/explicit-function-return-type": "off",
|
|
22
|
-
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
23
|
-
"no-console": "off",
|
|
24
|
-
"prefer-const": "error",
|
|
25
|
-
"no-var": "error"
|
|
26
|
-
},
|
|
27
|
-
"ignorePatterns": ["dist/", "node_modules/", "*.js"]
|
|
28
|
-
}
|
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
name: Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- 'v*'
|
|
7
|
-
|
|
8
|
-
permissions:
|
|
9
|
-
contents: write
|
|
10
|
-
id-token: write
|
|
11
|
-
|
|
12
|
-
jobs:
|
|
13
|
-
# ----------------------------------------------------------------
|
|
14
|
-
# JOB: BUILD WINDOWS
|
|
15
|
-
# ----------------------------------------------------------------
|
|
16
|
-
release-windows:
|
|
17
|
-
runs-on: windows-latest
|
|
18
|
-
steps:
|
|
19
|
-
- uses: actions/checkout@v4
|
|
20
|
-
with:
|
|
21
|
-
submodules: true
|
|
22
|
-
|
|
23
|
-
- uses: oven-sh/setup-bun@v1
|
|
24
|
-
|
|
25
|
-
- name: Build Windows Binary
|
|
26
|
-
run: |
|
|
27
|
-
bun install
|
|
28
|
-
bun run build:binary:windows
|
|
29
|
-
|
|
30
|
-
- name: Setup NSIS
|
|
31
|
-
run: |
|
|
32
|
-
choco install nsis
|
|
33
|
-
echo "C:\Program Files (x86)\NSIS" >> $env:GITHUB_PATH
|
|
34
|
-
|
|
35
|
-
# Install EnVar Plugin
|
|
36
|
-
Invoke-WebRequest -Uri "https://github.com/GsNSIS/EnVar/releases/download/v0.3.1/EnVar-Plugin.zip" -OutFile "envar.zip"
|
|
37
|
-
Expand-Archive "envar.zip" -DestinationPath "envar_temp"
|
|
38
|
-
Copy-Item "envar_temp\Plugins\x86-unicode\EnVar.dll" "C:\Program Files (x86)\NSIS\Plugins\x86-unicode\EnVar.dll"
|
|
39
|
-
|
|
40
|
-
- name: Create Installer (NSIS)
|
|
41
|
-
run: |
|
|
42
|
-
makensis packaging/windows/setup.nsi
|
|
43
|
-
|
|
44
|
-
- name: Upload Artifact
|
|
45
|
-
uses: actions/upload-artifact@v4
|
|
46
|
-
with:
|
|
47
|
-
name: windows-installer
|
|
48
|
-
path: dist/aicgen-setup-x64.exe
|
|
49
|
-
|
|
50
|
-
# ----------------------------------------------------------------
|
|
51
|
-
# JOB: BUILD LINUX
|
|
52
|
-
# ----------------------------------------------------------------
|
|
53
|
-
release-linux:
|
|
54
|
-
runs-on: ubuntu-latest
|
|
55
|
-
steps:
|
|
56
|
-
- uses: actions/checkout@v4
|
|
57
|
-
with:
|
|
58
|
-
submodules: true
|
|
59
|
-
|
|
60
|
-
- uses: oven-sh/setup-bun@v1
|
|
61
|
-
|
|
62
|
-
- name: Build Linux Binary
|
|
63
|
-
run: |
|
|
64
|
-
bun install
|
|
65
|
-
bun run build:binary:linux
|
|
66
|
-
|
|
67
|
-
- name: Create Deb Package
|
|
68
|
-
run: |
|
|
69
|
-
mkdir -p dist/deb/usr/bin
|
|
70
|
-
cp dist/aicgen-linux dist/deb/usr/bin/aicgen
|
|
71
|
-
chmod +x dist/deb/usr/bin/aicgen
|
|
72
|
-
|
|
73
|
-
mkdir -p dist/deb/DEBIAN
|
|
74
|
-
cp packaging/linux/control dist/deb/DEBIAN/control
|
|
75
|
-
|
|
76
|
-
dpkg-deb --build dist/deb dist/aicgen_amd64.deb
|
|
77
|
-
|
|
78
|
-
- name: Create RPM Package
|
|
79
|
-
run: |
|
|
80
|
-
sudo apt-get update
|
|
81
|
-
sudo apt-get install -y rpm
|
|
82
|
-
|
|
83
|
-
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
|
|
84
|
-
cp dist/aicgen-linux ~/rpmbuild/SOURCES/
|
|
85
|
-
cp packaging/linux/aicgen.spec ~/rpmbuild/SPECS/
|
|
86
|
-
|
|
87
|
-
rpmbuild -ba ~/rpmbuild/SPECS/aicgen.spec
|
|
88
|
-
cp ~/rpmbuild/RPMS/x86_64/*.rpm dist/aicgen_x86_64.rpm
|
|
89
|
-
|
|
90
|
-
- name: Upload Artifact
|
|
91
|
-
uses: actions/upload-artifact@v4
|
|
92
|
-
with:
|
|
93
|
-
name: linux-package
|
|
94
|
-
path: |
|
|
95
|
-
dist/aicgen_amd64.deb
|
|
96
|
-
dist/aicgen_x86_64.rpm
|
|
97
|
-
|
|
98
|
-
# ----------------------------------------------------------------
|
|
99
|
-
# JOB: BUILD MACOS
|
|
100
|
-
# ----------------------------------------------------------------
|
|
101
|
-
release-macos:
|
|
102
|
-
runs-on: macos-latest
|
|
103
|
-
steps:
|
|
104
|
-
- uses: actions/checkout@v4
|
|
105
|
-
with:
|
|
106
|
-
submodules: true
|
|
107
|
-
|
|
108
|
-
- uses: oven-sh/setup-bun@v1
|
|
109
|
-
|
|
110
|
-
- name: Build macOS Binary
|
|
111
|
-
run: |
|
|
112
|
-
bun install
|
|
113
|
-
bun run build:binary:macos
|
|
114
|
-
|
|
115
|
-
- name: Create PKG Installer
|
|
116
|
-
run: |
|
|
117
|
-
# Structure
|
|
118
|
-
mkdir -p dist/pkg/usr/local/bin
|
|
119
|
-
cp dist/aicgen-macos dist/pkg/usr/local/bin/aicgen
|
|
120
|
-
chmod +x dist/pkg/usr/local/bin/aicgen
|
|
121
|
-
|
|
122
|
-
# Build PKG
|
|
123
|
-
pkgbuild --root dist/pkg \
|
|
124
|
-
--identifier com.lpsandaruwan.aicgen \
|
|
125
|
-
--version ${{ github.ref_name }} \
|
|
126
|
-
--install-location / \
|
|
127
|
-
--scripts packaging/macos/scripts \
|
|
128
|
-
dist/aicgen.pkg
|
|
129
|
-
|
|
130
|
-
- name: Upload Artifact
|
|
131
|
-
uses: actions/upload-artifact@v4
|
|
132
|
-
with:
|
|
133
|
-
name: macos-installer
|
|
134
|
-
path: dist/aicgen.pkg
|
|
135
|
-
|
|
136
|
-
# ----------------------------------------------------------------
|
|
137
|
-
publish-npm:
|
|
138
|
-
needs: [release-windows, release-linux, release-macos]
|
|
139
|
-
runs-on: ubuntu-latest
|
|
140
|
-
steps:
|
|
141
|
-
- uses: actions/checkout@v4
|
|
142
|
-
with:
|
|
143
|
-
submodules: true
|
|
144
|
-
|
|
145
|
-
- uses: oven-sh/setup-bun@v1
|
|
146
|
-
|
|
147
|
-
- uses: actions/setup-node@v4
|
|
148
|
-
with:
|
|
149
|
-
node-version: '20.x'
|
|
150
|
-
registry-url: 'https://registry.npmjs.org'
|
|
151
|
-
|
|
152
|
-
- name: Update npm
|
|
153
|
-
run: npm install -g npm@latest
|
|
154
|
-
|
|
155
|
-
- name: Build and Publish
|
|
156
|
-
run: |
|
|
157
|
-
bun install
|
|
158
|
-
bun run build
|
|
159
|
-
npm publish --access public
|
|
160
|
-
|
|
161
|
-
# ----------------------------------------------------------------
|
|
162
|
-
# JOB: PUBLISH RELEASE
|
|
163
|
-
# ----------------------------------------------------------------
|
|
164
|
-
publish-release:
|
|
165
|
-
needs: [release-windows, release-linux, release-macos]
|
|
166
|
-
runs-on: ubuntu-latest
|
|
167
|
-
steps:
|
|
168
|
-
- uses: actions/download-artifact@v4
|
|
169
|
-
|
|
170
|
-
- name: Create Release
|
|
171
|
-
uses: softprops/action-gh-release@v1
|
|
172
|
-
with:
|
|
173
|
-
files: |
|
|
174
|
-
windows-installer/aicgen-setup-x64.exe
|
|
175
|
-
linux-package/aicgen_amd64.deb
|
|
176
|
-
linux-package/aicgen_x86_64.rpm
|
|
177
|
-
macos-installer/aicgen.pkg
|
|
178
|
-
draft: false
|
|
179
|
-
prerelease: false
|
|
180
|
-
generate_release_notes: true
|