syntra 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +239 -0
- package/dist/adapters/claude.d.ts +3 -0
- package/dist/adapters/claude.d.ts.map +1 -0
- package/dist/adapters/claude.js +19 -0
- package/dist/adapters/claude.js.map +1 -0
- package/dist/adapters/common.d.ts +14 -0
- package/dist/adapters/common.d.ts.map +1 -0
- package/dist/adapters/common.js +38 -0
- package/dist/adapters/common.js.map +1 -0
- package/dist/adapters/copilot.d.ts +5 -0
- package/dist/adapters/copilot.d.ts.map +1 -0
- package/dist/adapters/copilot.js +25 -0
- package/dist/adapters/copilot.js.map +1 -0
- package/dist/adapters/cursor.d.ts +3 -0
- package/dist/adapters/cursor.d.ts.map +1 -0
- package/dist/adapters/cursor.js +26 -0
- package/dist/adapters/cursor.js.map +1 -0
- package/dist/adapters/index.d.ts +12 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +27 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/commands/add.d.ts +2 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +154 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/done.d.ts +2 -0
- package/dist/commands/done.d.ts.map +1 -0
- package/dist/commands/done.js +20 -0
- package/dist/commands/done.js.map +1 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +129 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/sync.d.ts +8 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +31 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/template.d.ts +3 -0
- package/dist/commands/template.d.ts.map +1 -0
- package/dist/commands/template.js +51 -0
- package/dist/commands/template.js.map +1 -0
- package/dist/commands/validate.d.ts +6 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +101 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/detectors/cicd.d.ts +2 -0
- package/dist/detectors/cicd.d.ts.map +1 -0
- package/dist/detectors/cicd.js +24 -0
- package/dist/detectors/cicd.js.map +1 -0
- package/dist/detectors/existingAi.d.ts +6 -0
- package/dist/detectors/existingAi.d.ts.map +1 -0
- package/dist/detectors/existingAi.js +10 -0
- package/dist/detectors/existingAi.js.map +1 -0
- package/dist/detectors/framework.d.ts +3 -0
- package/dist/detectors/framework.d.ts.map +1 -0
- package/dist/detectors/framework.js +75 -0
- package/dist/detectors/framework.js.map +1 -0
- package/dist/detectors/index.d.ts +9 -0
- package/dist/detectors/index.d.ts.map +1 -0
- package/dist/detectors/index.js +29 -0
- package/dist/detectors/index.js.map +1 -0
- package/dist/detectors/language.d.ts +3 -0
- package/dist/detectors/language.d.ts.map +1 -0
- package/dist/detectors/language.js +34 -0
- package/dist/detectors/language.js.map +1 -0
- package/dist/detectors/monorepo.d.ts +2 -0
- package/dist/detectors/monorepo.d.ts.map +1 -0
- package/dist/detectors/monorepo.js +31 -0
- package/dist/detectors/monorepo.js.map +1 -0
- package/dist/detectors/packageManager.d.ts +3 -0
- package/dist/detectors/packageManager.d.ts.map +1 -0
- package/dist/detectors/packageManager.js +42 -0
- package/dist/detectors/packageManager.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +125 -0
- package/dist/index.js.map +1 -0
- package/dist/templates/agents/bugFixer.d.ts +2 -0
- package/dist/templates/agents/bugFixer.d.ts.map +1 -0
- package/dist/templates/agents/bugFixer.js +37 -0
- package/dist/templates/agents/bugFixer.js.map +1 -0
- package/dist/templates/agents/codeGenerator.d.ts +2 -0
- package/dist/templates/agents/codeGenerator.d.ts.map +1 -0
- package/dist/templates/agents/codeGenerator.js +41 -0
- package/dist/templates/agents/codeGenerator.js.map +1 -0
- package/dist/templates/agents/codeReviewer.d.ts +2 -0
- package/dist/templates/agents/codeReviewer.d.ts.map +1 -0
- package/dist/templates/agents/codeReviewer.js +43 -0
- package/dist/templates/agents/codeReviewer.js.map +1 -0
- package/dist/templates/agents/index.d.ts +5 -0
- package/dist/templates/agents/index.d.ts.map +1 -0
- package/dist/templates/agents/index.js +5 -0
- package/dist/templates/agents/index.js.map +1 -0
- package/dist/templates/agents/taskPlanner.d.ts +2 -0
- package/dist/templates/agents/taskPlanner.d.ts.map +1 -0
- package/dist/templates/agents/taskPlanner.js +47 -0
- package/dist/templates/agents/taskPlanner.js.map +1 -0
- package/dist/templates/engine.d.ts +9 -0
- package/dist/templates/engine.d.ts.map +1 -0
- package/dist/templates/engine.js +16 -0
- package/dist/templates/engine.js.map +1 -0
- package/dist/templates/files/index.d.ts +3 -0
- package/dist/templates/files/index.d.ts.map +1 -0
- package/dist/templates/files/index.js +51 -0
- package/dist/templates/files/index.js.map +1 -0
- package/dist/templates/instructions/architecture.d.ts +2 -0
- package/dist/templates/instructions/architecture.d.ts.map +1 -0
- package/dist/templates/instructions/architecture.js +50 -0
- package/dist/templates/instructions/architecture.js.map +1 -0
- package/dist/templates/instructions/deploy.d.ts +2 -0
- package/dist/templates/instructions/deploy.d.ts.map +1 -0
- package/dist/templates/instructions/deploy.js +53 -0
- package/dist/templates/instructions/deploy.js.map +1 -0
- package/dist/templates/instructions/index.d.ts +6 -0
- package/dist/templates/instructions/index.d.ts.map +1 -0
- package/dist/templates/instructions/index.js +6 -0
- package/dist/templates/instructions/index.js.map +1 -0
- package/dist/templates/instructions/security.d.ts +2 -0
- package/dist/templates/instructions/security.d.ts.map +1 -0
- package/dist/templates/instructions/security.js +43 -0
- package/dist/templates/instructions/security.js.map +1 -0
- package/dist/templates/instructions/style.d.ts +2 -0
- package/dist/templates/instructions/style.d.ts.map +1 -0
- package/dist/templates/instructions/style.js +45 -0
- package/dist/templates/instructions/style.js.map +1 -0
- package/dist/templates/instructions/testing.d.ts +2 -0
- package/dist/templates/instructions/testing.d.ts.map +1 -0
- package/dist/templates/instructions/testing.js +61 -0
- package/dist/templates/instructions/testing.js.map +1 -0
- package/dist/templates/registry.d.ts +13 -0
- package/dist/templates/registry.d.ts.map +1 -0
- package/dist/templates/registry.js +89 -0
- package/dist/templates/registry.js.map +1 -0
- package/dist/utils/fs.d.ts +16 -0
- package/dist/utils/fs.d.ts.map +1 -0
- package/dist/utils/fs.js +88 -0
- package/dist/utils/fs.js.map +1 -0
- package/dist/utils/logger.d.ts +16 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +68 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/prompt.d.ts +9 -0
- package/dist/utils/prompt.d.ts.map +1 -0
- package/dist/utils/prompt.js +48 -0
- package/dist/utils/prompt.js.map +1 -0
- package/dist/utils/types.d.ts +68 -0
- package/dist/utils/types.d.ts.map +1 -0
- package/dist/utils/types.js +2 -0
- package/dist/utils/types.js.map +1 -0
- package/dist/validators/agents.d.ts +3 -0
- package/dist/validators/agents.d.ts.map +1 -0
- package/dist/validators/agents.js +40 -0
- package/dist/validators/agents.js.map +1 -0
- package/dist/validators/config.d.ts +12 -0
- package/dist/validators/config.d.ts.map +1 -0
- package/dist/validators/config.js +114 -0
- package/dist/validators/config.js.map +1 -0
- package/dist/validators/instructions.d.ts +10 -0
- package/dist/validators/instructions.d.ts.map +1 -0
- package/dist/validators/instructions.js +34 -0
- package/dist/validators/instructions.js.map +1 -0
- package/dist/validators/syncStatus.d.ts +9 -0
- package/dist/validators/syncStatus.d.ts.map +1 -0
- package/dist/validators/syncStatus.js +92 -0
- package/dist/validators/syncStatus.js.map +1 -0
- package/dist/validators/tasks.d.ts +3 -0
- package/dist/validators/tasks.d.ts.map +1 -0
- package/dist/validators/tasks.js +72 -0
- package/dist/validators/tasks.js.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architecture.d.ts","sourceRoot":"","sources":["../../../src/templates/instructions/architecture.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,klDAgDhC,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export const architectureTemplate = `# Architecture Instructions
|
|
2
|
+
|
|
3
|
+
## Project Type
|
|
4
|
+
{{#if-includes projectProfile.language 'typescript'}}
|
|
5
|
+
This is a {{projectProfile.framework}} project written in TypeScript.
|
|
6
|
+
{{else}}
|
|
7
|
+
This is a {{projectProfile.framework}} project written in {{projectProfile.language}}.
|
|
8
|
+
{{/if-includes}}
|
|
9
|
+
|
|
10
|
+
## Language Standards
|
|
11
|
+
{{#if-includes projectProfile.language 'typescript'}}
|
|
12
|
+
- **Language**: TypeScript
|
|
13
|
+
- **Strict Mode**: Enabled
|
|
14
|
+
- **No \`any\` types**: Unless explicitly justified with a comment
|
|
15
|
+
- **Type Safety**: All public APIs must be fully typed
|
|
16
|
+
{{else if-includes projectProfile.language 'javascript'}}
|
|
17
|
+
- **Language**: JavaScript (Modern ES2020+)
|
|
18
|
+
- **JSDoc**: Use for documenting complex functions
|
|
19
|
+
{{else if-includes projectProfile.language 'python'}}
|
|
20
|
+
- **Language**: Python 3.8+
|
|
21
|
+
- **Type Hints**: Required for all functions and class methods
|
|
22
|
+
- **Docstrings**: Use Google-style docstrings
|
|
23
|
+
{{/if-includes}}
|
|
24
|
+
|
|
25
|
+
## Project Structure
|
|
26
|
+
<!-- Describe your project's folder structure and conventions -->
|
|
27
|
+
|
|
28
|
+
\`\`\`
|
|
29
|
+
{{projectName}}/
|
|
30
|
+
├── src/
|
|
31
|
+
├── tests/
|
|
32
|
+
├── docs/
|
|
33
|
+
└── README.md
|
|
34
|
+
\`\`\`
|
|
35
|
+
|
|
36
|
+
## Module Organization
|
|
37
|
+
- **Single Responsibility**: Each module has one clear purpose
|
|
38
|
+
- **Clear dependencies**: No circular dependencies
|
|
39
|
+
- **Exports**: Only export what's meant to be public
|
|
40
|
+
|
|
41
|
+
## Conventions
|
|
42
|
+
<!-- Document any custom conventions for this project -->
|
|
43
|
+
|
|
44
|
+
## Code Patterns
|
|
45
|
+
- **Error Handling**: [Describe your error handling strategy]
|
|
46
|
+
- **Logging**: [Describe logging conventions]
|
|
47
|
+
- **Configuration**: [Describe how configuration is managed]
|
|
48
|
+
|
|
49
|
+
`;
|
|
50
|
+
//# sourceMappingURL=architecture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architecture.js","sourceRoot":"","sources":["../../../src/templates/instructions/architecture.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDnC,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const deployTemplate = "# Deployment Instructions\n\n## Pre-Deployment Checklist\n- [ ] All tests passing\n- [ ] Code review approved\n- [ ] Security audit passed\n- [ ] Environment variables configured\n- [ ] Documentation updated\n- [ ] Version bumped (semantic versioning)\n\n## Build Process\n{{#if-includes projectProfile.language 'typescript'}}\n```bash\nnpm run build\n# Check dist/ folder is generated correctly\n```\n{{else if-includes projectProfile.language 'python'}}\n```bash\npython -m pip install -e .\npython -m pip install -r requirements-dev.txt\n```\n{{/if-includes}}\n\n## Deployment Environments\n- **Development**: Automatic deployment on push to develop branch\n- **Staging**: Automatic deployment on push to staging branch, requires approval\n- **Production**: Manual deployment with approval from 2 team members\n\n## Rollback Procedure\n- **Quick rollback**: Revert to previous version tag\n- **Database migrations**: Document rollback steps\n- **Communication**: Notify team immediately\n- **Post-mortem**: Document what went wrong\n\n## Monitoring Post-Deployment\n- **Health checks**: Verify endpoints responding\n- **Error logs**: Monitor for new errors\n- **Performance metrics**: Check latency and throughput\n- **User reports**: Monitor for user-reported issues\n\n## Deployment Tools\n{{#if-includes projectProfile.cicd 'github-actions'}}\n- **CI/CD**: GitHub Actions\n- **Workflow**: See `.github/workflows/deploy.yml`\n{{/if-includes}}\n\n## Versioning\n- **Semantic Versioning**: MAJOR.MINOR.PATCH\n- **Git tags**: Tag releases automatically\n- **Changelog**: Maintain CHANGELOG.md\n\n";
|
|
2
|
+
//# sourceMappingURL=deploy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/templates/instructions/deploy.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,mkDAmD1B,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export const deployTemplate = `# Deployment Instructions
|
|
2
|
+
|
|
3
|
+
## Pre-Deployment Checklist
|
|
4
|
+
- [ ] All tests passing
|
|
5
|
+
- [ ] Code review approved
|
|
6
|
+
- [ ] Security audit passed
|
|
7
|
+
- [ ] Environment variables configured
|
|
8
|
+
- [ ] Documentation updated
|
|
9
|
+
- [ ] Version bumped (semantic versioning)
|
|
10
|
+
|
|
11
|
+
## Build Process
|
|
12
|
+
{{#if-includes projectProfile.language 'typescript'}}
|
|
13
|
+
\`\`\`bash
|
|
14
|
+
npm run build
|
|
15
|
+
# Check dist/ folder is generated correctly
|
|
16
|
+
\`\`\`
|
|
17
|
+
{{else if-includes projectProfile.language 'python'}}
|
|
18
|
+
\`\`\`bash
|
|
19
|
+
python -m pip install -e .
|
|
20
|
+
python -m pip install -r requirements-dev.txt
|
|
21
|
+
\`\`\`
|
|
22
|
+
{{/if-includes}}
|
|
23
|
+
|
|
24
|
+
## Deployment Environments
|
|
25
|
+
- **Development**: Automatic deployment on push to develop branch
|
|
26
|
+
- **Staging**: Automatic deployment on push to staging branch, requires approval
|
|
27
|
+
- **Production**: Manual deployment with approval from 2 team members
|
|
28
|
+
|
|
29
|
+
## Rollback Procedure
|
|
30
|
+
- **Quick rollback**: Revert to previous version tag
|
|
31
|
+
- **Database migrations**: Document rollback steps
|
|
32
|
+
- **Communication**: Notify team immediately
|
|
33
|
+
- **Post-mortem**: Document what went wrong
|
|
34
|
+
|
|
35
|
+
## Monitoring Post-Deployment
|
|
36
|
+
- **Health checks**: Verify endpoints responding
|
|
37
|
+
- **Error logs**: Monitor for new errors
|
|
38
|
+
- **Performance metrics**: Check latency and throughput
|
|
39
|
+
- **User reports**: Monitor for user-reported issues
|
|
40
|
+
|
|
41
|
+
## Deployment Tools
|
|
42
|
+
{{#if-includes projectProfile.cicd 'github-actions'}}
|
|
43
|
+
- **CI/CD**: GitHub Actions
|
|
44
|
+
- **Workflow**: See \`.github/workflows/deploy.yml\`
|
|
45
|
+
{{/if-includes}}
|
|
46
|
+
|
|
47
|
+
## Versioning
|
|
48
|
+
- **Semantic Versioning**: MAJOR.MINOR.PATCH
|
|
49
|
+
- **Git tags**: Tag releases automatically
|
|
50
|
+
- **Changelog**: Maintain CHANGELOG.md
|
|
51
|
+
|
|
52
|
+
`;
|
|
53
|
+
//# sourceMappingURL=deploy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../../src/templates/instructions/deploy.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmD7B,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { architectureTemplate } from './architecture.js';
|
|
2
|
+
export { styleTemplate } from './style.js';
|
|
3
|
+
export { testingTemplate } from './testing.js';
|
|
4
|
+
export { securityTemplate } from './security.js';
|
|
5
|
+
export { deployTemplate } from './deploy.js';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/instructions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { architectureTemplate } from './architecture.js';
|
|
2
|
+
export { styleTemplate } from './style.js';
|
|
3
|
+
export { testingTemplate } from './testing.js';
|
|
4
|
+
export { securityTemplate } from './security.js';
|
|
5
|
+
export { deployTemplate } from './deploy.js';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/instructions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const securityTemplate = "# Security Instructions\n\n## Environment Variables\n- **No secrets in code**: All secrets must be in `.env` (commit `.env.example` without values)\n- **No logging secrets**: Never log API keys, tokens, or passwords\n- **Rotation**: Change secrets regularly and when team members leave\n\n## Dependencies\n- **Audit**: Run `npm audit` and `npm audit fix` regularly\n- **Updates**: Keep dependencies up-to-date\n- **Security advisories**: Address immediately\n\n## Input Validation\n- **Validate all inputs**: Never trust user input\n- **Sanitize for context**: Sanitize for HTML/SQL/Command context appropriately\n- **Whitelist approach**: Validate against known good patterns\n\n## Authentication & Authorization\n- **Never store passwords**: Use cryptographic hashing (bcrypt, argon2)\n- **Session security**: Use secure session management\n- **Token expiry**: Implement token expiration\n- **RBAC**: Implement role-based access control\n\n## API Security\n- **Rate limiting**: Implement to prevent abuse\n- **CORS**: Configure properly, don't use wildcard in production\n- **HTTPS/TLS**: Always required in production\n- **API versioning**: Support versioning for backward compatibility\n\n## Data Protection\n- **Encryption at rest**: Encrypt sensitive data in databases\n- **Encryption in transit**: Use HTTPS/TLS\n- **PII handling**: Comply with GDPR, CCPA, and local regulations\n- **Data retention**: Delete data when no longer needed\n\n## Code Security\n- **SQL Injection**: Use parameterized queries\n- **XSS Protection**: Escape output, use Content Security Policy\n- **CSRF Protection**: Use CSRF tokens\n- **Dependency scanning**: Regular dependency audits\n\n";
|
|
2
|
+
//# sourceMappingURL=security.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../../src/templates/instructions/security.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,+oDAyC5B,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export const securityTemplate = `# Security Instructions
|
|
2
|
+
|
|
3
|
+
## Environment Variables
|
|
4
|
+
- **No secrets in code**: All secrets must be in \`.env\` (commit \`.env.example\` without values)
|
|
5
|
+
- **No logging secrets**: Never log API keys, tokens, or passwords
|
|
6
|
+
- **Rotation**: Change secrets regularly and when team members leave
|
|
7
|
+
|
|
8
|
+
## Dependencies
|
|
9
|
+
- **Audit**: Run \`npm audit\` and \`npm audit fix\` regularly
|
|
10
|
+
- **Updates**: Keep dependencies up-to-date
|
|
11
|
+
- **Security advisories**: Address immediately
|
|
12
|
+
|
|
13
|
+
## Input Validation
|
|
14
|
+
- **Validate all inputs**: Never trust user input
|
|
15
|
+
- **Sanitize for context**: Sanitize for HTML/SQL/Command context appropriately
|
|
16
|
+
- **Whitelist approach**: Validate against known good patterns
|
|
17
|
+
|
|
18
|
+
## Authentication & Authorization
|
|
19
|
+
- **Never store passwords**: Use cryptographic hashing (bcrypt, argon2)
|
|
20
|
+
- **Session security**: Use secure session management
|
|
21
|
+
- **Token expiry**: Implement token expiration
|
|
22
|
+
- **RBAC**: Implement role-based access control
|
|
23
|
+
|
|
24
|
+
## API Security
|
|
25
|
+
- **Rate limiting**: Implement to prevent abuse
|
|
26
|
+
- **CORS**: Configure properly, don't use wildcard in production
|
|
27
|
+
- **HTTPS/TLS**: Always required in production
|
|
28
|
+
- **API versioning**: Support versioning for backward compatibility
|
|
29
|
+
|
|
30
|
+
## Data Protection
|
|
31
|
+
- **Encryption at rest**: Encrypt sensitive data in databases
|
|
32
|
+
- **Encryption in transit**: Use HTTPS/TLS
|
|
33
|
+
- **PII handling**: Comply with GDPR, CCPA, and local regulations
|
|
34
|
+
- **Data retention**: Delete data when no longer needed
|
|
35
|
+
|
|
36
|
+
## Code Security
|
|
37
|
+
- **SQL Injection**: Use parameterized queries
|
|
38
|
+
- **XSS Protection**: Escape output, use Content Security Policy
|
|
39
|
+
- **CSRF Protection**: Use CSRF tokens
|
|
40
|
+
- **Dependency scanning**: Regular dependency audits
|
|
41
|
+
|
|
42
|
+
`;
|
|
43
|
+
//# sourceMappingURL=security.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security.js","sourceRoot":"","sources":["../../../src/templates/instructions/security.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyC/B,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const styleTemplate = "# Code Style Instructions\n\n## Naming Conventions\n{{#if-includes projectProfile.language 'typescript'}}\n- **Classes**: PascalCase (e.g., `UserManager`)\n- **Functions/Methods**: camelCase (e.g., `getUserById`)\n- **Constants**: UPPER_SNAKE_CASE (e.g., `MAX_RETRIES`)\n- **Private members**: Prefix with underscore (e.g., `_internalState`)\n- **Interfaces**: PascalCase, optionally prefix with I (e.g., `IUserRepository`)\n{{else if-includes projectProfile.language 'python'}}\n- **Classes**: PascalCase (e.g., `UserManager`)\n- **Functions**: snake_case (e.g., `get_user_by_id`)\n- **Constants**: UPPER_SNAKE_CASE (e.g., `MAX_RETRIES`)\n- **Private members**: Prefix with underscore (e.g., `_internal_state`)\n{{/if-includes}}\n\n## Code Formatting\n- **Line length**: 100 characters max\n- **Indentation**: 2 spaces (no tabs)\n- **Semicolons**: {{#if-includes projectProfile.language 'typescript'}}Required{{else}}As needed{{/if-includes}}\n- **Quotes**: Single quotes for strings where possible\n- **Trailing commas**: Always use in multi-line structures\n\n## Comments\n- **Comments should explain WHY, not WHAT**: Good code is self-documenting\n- **TODO comments**: Use format `// TODO: description with ticket ID if applicable`\n- **Documentation**: Use JSDoc/docstrings for public APIs\n\n## Imports/Includes\n- **Order**: External imports first, then internal imports, separated by blank line\n- **Organization**: Alphabetically sorted within each group\n- **Cleanup**: Remove unused imports\n\n## Function Guidelines\n- **Maximum length**: 50 lines (consider breaking into smaller functions)\n- **Parameters**: Maximum 3-4 parameters (use object destructuring for more)\n- **Return types**: Always specify for {{#if-includes projectProfile.language 'typescript'}}TypeScript{{else}}documented in docstring{{/if-includes}}\n\n## Error Handling\n- Use specific error types rather than generic `Error`\n- Provide meaningful error messages with context\n- Avoid silent failures or unhandled exceptions\n\n";
|
|
2
|
+
//# sourceMappingURL=style.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../src/templates/instructions/style.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,g+DA2CzB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export const styleTemplate = `# Code Style Instructions
|
|
2
|
+
|
|
3
|
+
## Naming Conventions
|
|
4
|
+
{{#if-includes projectProfile.language 'typescript'}}
|
|
5
|
+
- **Classes**: PascalCase (e.g., \`UserManager\`)
|
|
6
|
+
- **Functions/Methods**: camelCase (e.g., \`getUserById\`)
|
|
7
|
+
- **Constants**: UPPER_SNAKE_CASE (e.g., \`MAX_RETRIES\`)
|
|
8
|
+
- **Private members**: Prefix with underscore (e.g., \`_internalState\`)
|
|
9
|
+
- **Interfaces**: PascalCase, optionally prefix with I (e.g., \`IUserRepository\`)
|
|
10
|
+
{{else if-includes projectProfile.language 'python'}}
|
|
11
|
+
- **Classes**: PascalCase (e.g., \`UserManager\`)
|
|
12
|
+
- **Functions**: snake_case (e.g., \`get_user_by_id\`)
|
|
13
|
+
- **Constants**: UPPER_SNAKE_CASE (e.g., \`MAX_RETRIES\`)
|
|
14
|
+
- **Private members**: Prefix with underscore (e.g., \`_internal_state\`)
|
|
15
|
+
{{/if-includes}}
|
|
16
|
+
|
|
17
|
+
## Code Formatting
|
|
18
|
+
- **Line length**: 100 characters max
|
|
19
|
+
- **Indentation**: 2 spaces (no tabs)
|
|
20
|
+
- **Semicolons**: {{#if-includes projectProfile.language 'typescript'}}Required{{else}}As needed{{/if-includes}}
|
|
21
|
+
- **Quotes**: Single quotes for strings where possible
|
|
22
|
+
- **Trailing commas**: Always use in multi-line structures
|
|
23
|
+
|
|
24
|
+
## Comments
|
|
25
|
+
- **Comments should explain WHY, not WHAT**: Good code is self-documenting
|
|
26
|
+
- **TODO comments**: Use format \`// TODO: description with ticket ID if applicable\`
|
|
27
|
+
- **Documentation**: Use JSDoc/docstrings for public APIs
|
|
28
|
+
|
|
29
|
+
## Imports/Includes
|
|
30
|
+
- **Order**: External imports first, then internal imports, separated by blank line
|
|
31
|
+
- **Organization**: Alphabetically sorted within each group
|
|
32
|
+
- **Cleanup**: Remove unused imports
|
|
33
|
+
|
|
34
|
+
## Function Guidelines
|
|
35
|
+
- **Maximum length**: 50 lines (consider breaking into smaller functions)
|
|
36
|
+
- **Parameters**: Maximum 3-4 parameters (use object destructuring for more)
|
|
37
|
+
- **Return types**: Always specify for {{#if-includes projectProfile.language 'typescript'}}TypeScript{{else}}documented in docstring{{/if-includes}}
|
|
38
|
+
|
|
39
|
+
## Error Handling
|
|
40
|
+
- Use specific error types rather than generic \`Error\`
|
|
41
|
+
- Provide meaningful error messages with context
|
|
42
|
+
- Avoid silent failures or unhandled exceptions
|
|
43
|
+
|
|
44
|
+
`;
|
|
45
|
+
//# sourceMappingURL=style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"style.js","sourceRoot":"","sources":["../../../src/templates/instructions/style.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2C5B,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const testingTemplate = "# Testing Instructions\n\n## Testing Framework\n{{#if-includes projectProfile.framework 'next.js'}}\n- **Unit Tests**: Jest (Next.js default)\n- **Integration Tests**: Jest with Node environment\n- **E2E Tests**: Playwright or Cypress recommended\n{{else if-includes projectProfile.framework 'react'}}\n- **Unit Tests**: Jest or Vitest\n- **Component Tests**: React Testing Library\n- **E2E Tests**: Playwright or Cypress\n{{else if-includes projectProfile.language 'python'}}\n- **Unit Tests**: pytest\n- **Integration Tests**: pytest with fixtures\n- **E2E Tests**: pytest-selenium or similar\n{{/if-includes}}\n\n## Test Organization\n- **Location**: `tests/` or `__tests__/` directory parallel to source\n- **File naming**: `*.test.ts` or `*.spec.ts`\n- **Structure**: One test file per source file\n\n## Test Coverage Requirements\n- **Minimum coverage**: 80% line coverage\n- **Critical paths**: 100% coverage required\n- **Coverage report**: Generated on every test run\n\n## Unit Test Guidelines\n- **Test naming**: Describe what the function does (e.g., `describes what getUserById returns when user exists`)\n- **Arrange-Act-Assert**: Follow AAA pattern\n- **One assertion per test**: When possible (or test one behavior)\n- **Mocking**: Mock external dependencies, test business logic\n- **Avoid flakiness**: No time-dependent tests, no random data\n\n## Integration Test Guidelines\n- **Test real interactions**: Database, APIs, file system\n- **Setup/Teardown**: Clean state for each test\n- **Test data**: Use fixtures or factories\n\n## E2E Test Guidelines\n- **User perspective**: Test user workflows, not implementation details\n- **Stability**: Retry mechanisms for network/timing issues\n- **Critical paths**: Focus on main user journeys\n\n## Running Tests\n```bash\n# Run all tests\nnpm test\n\n# Watch mode\nnpm test -- --watch\n\n# With coverage\nnpm test -- --coverage\n\n# Specific test file\nnpm test -- tests/utils/date.test.ts\n```\n\n";
|
|
2
|
+
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../../src/templates/instructions/testing.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,g7DA2D3B,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export const testingTemplate = `# Testing Instructions
|
|
2
|
+
|
|
3
|
+
## Testing Framework
|
|
4
|
+
{{#if-includes projectProfile.framework 'next.js'}}
|
|
5
|
+
- **Unit Tests**: Jest (Next.js default)
|
|
6
|
+
- **Integration Tests**: Jest with Node environment
|
|
7
|
+
- **E2E Tests**: Playwright or Cypress recommended
|
|
8
|
+
{{else if-includes projectProfile.framework 'react'}}
|
|
9
|
+
- **Unit Tests**: Jest or Vitest
|
|
10
|
+
- **Component Tests**: React Testing Library
|
|
11
|
+
- **E2E Tests**: Playwright or Cypress
|
|
12
|
+
{{else if-includes projectProfile.language 'python'}}
|
|
13
|
+
- **Unit Tests**: pytest
|
|
14
|
+
- **Integration Tests**: pytest with fixtures
|
|
15
|
+
- **E2E Tests**: pytest-selenium or similar
|
|
16
|
+
{{/if-includes}}
|
|
17
|
+
|
|
18
|
+
## Test Organization
|
|
19
|
+
- **Location**: \`tests/\` or \`__tests__/\` directory parallel to source
|
|
20
|
+
- **File naming**: \`*.test.ts\` or \`*.spec.ts\`
|
|
21
|
+
- **Structure**: One test file per source file
|
|
22
|
+
|
|
23
|
+
## Test Coverage Requirements
|
|
24
|
+
- **Minimum coverage**: 80% line coverage
|
|
25
|
+
- **Critical paths**: 100% coverage required
|
|
26
|
+
- **Coverage report**: Generated on every test run
|
|
27
|
+
|
|
28
|
+
## Unit Test Guidelines
|
|
29
|
+
- **Test naming**: Describe what the function does (e.g., \`describes what getUserById returns when user exists\`)
|
|
30
|
+
- **Arrange-Act-Assert**: Follow AAA pattern
|
|
31
|
+
- **One assertion per test**: When possible (or test one behavior)
|
|
32
|
+
- **Mocking**: Mock external dependencies, test business logic
|
|
33
|
+
- **Avoid flakiness**: No time-dependent tests, no random data
|
|
34
|
+
|
|
35
|
+
## Integration Test Guidelines
|
|
36
|
+
- **Test real interactions**: Database, APIs, file system
|
|
37
|
+
- **Setup/Teardown**: Clean state for each test
|
|
38
|
+
- **Test data**: Use fixtures or factories
|
|
39
|
+
|
|
40
|
+
## E2E Test Guidelines
|
|
41
|
+
- **User perspective**: Test user workflows, not implementation details
|
|
42
|
+
- **Stability**: Retry mechanisms for network/timing issues
|
|
43
|
+
- **Critical paths**: Focus on main user journeys
|
|
44
|
+
|
|
45
|
+
## Running Tests
|
|
46
|
+
\`\`\`bash
|
|
47
|
+
# Run all tests
|
|
48
|
+
npm test
|
|
49
|
+
|
|
50
|
+
# Watch mode
|
|
51
|
+
npm test -- --watch
|
|
52
|
+
|
|
53
|
+
# With coverage
|
|
54
|
+
npm test -- --coverage
|
|
55
|
+
|
|
56
|
+
# Specific test file
|
|
57
|
+
npm test -- tests/utils/date.test.ts
|
|
58
|
+
\`\`\`
|
|
59
|
+
|
|
60
|
+
`;
|
|
61
|
+
//# sourceMappingURL=testing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.js","sourceRoot":"","sources":["../../../src/templates/instructions/testing.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2D9B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type TemplateData } from './engine.js';
|
|
2
|
+
type TemplateType = 'instruction' | 'agent' | 'task' | 'skill';
|
|
3
|
+
interface TemplateEntry {
|
|
4
|
+
type: TemplateType;
|
|
5
|
+
name: string;
|
|
6
|
+
template: string;
|
|
7
|
+
description: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function getTemplate(name: string): TemplateEntry | undefined;
|
|
10
|
+
export declare function listTemplates(type?: TemplateType): TemplateEntry[];
|
|
11
|
+
export declare function renderTemplate(name: string, data: TemplateData): string;
|
|
12
|
+
export { TemplateData };
|
|
13
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/templates/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAgBjE,KAAK,YAAY,GAAG,aAAa,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;AAE/D,UAAU,aAAa;IACrB,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB;AA0ED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAEnE;AAED,wBAAgB,aAAa,CAAC,IAAI,CAAC,EAAE,YAAY,GAAG,aAAa,EAAE,CAElE;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM,CAMvE;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { compileTemplate } from './engine.js';
|
|
2
|
+
import { architectureTemplate, styleTemplate, testingTemplate, securityTemplate, deployTemplate, } from './instructions/index.js';
|
|
3
|
+
import { codeGeneratorTemplate, codeReviewerTemplate, taskPlannerTemplate, bugFixerTemplate, } from './agents/index.js';
|
|
4
|
+
import { taskTemplate, skillTemplate } from './files/index.js';
|
|
5
|
+
const templates = new Map([
|
|
6
|
+
// Instruction templates
|
|
7
|
+
['architecture', {
|
|
8
|
+
type: 'instruction',
|
|
9
|
+
name: 'architecture',
|
|
10
|
+
template: architectureTemplate,
|
|
11
|
+
description: 'Architecture and design patterns',
|
|
12
|
+
}],
|
|
13
|
+
['style', {
|
|
14
|
+
type: 'instruction',
|
|
15
|
+
name: 'style',
|
|
16
|
+
template: styleTemplate,
|
|
17
|
+
description: 'Code style and conventions',
|
|
18
|
+
}],
|
|
19
|
+
['testing', {
|
|
20
|
+
type: 'instruction',
|
|
21
|
+
name: 'testing',
|
|
22
|
+
template: testingTemplate,
|
|
23
|
+
description: 'Testing strategies and best practices',
|
|
24
|
+
}],
|
|
25
|
+
['security', {
|
|
26
|
+
type: 'instruction',
|
|
27
|
+
name: 'security',
|
|
28
|
+
template: securityTemplate,
|
|
29
|
+
description: 'Security guidelines',
|
|
30
|
+
}],
|
|
31
|
+
['deploy', {
|
|
32
|
+
type: 'instruction',
|
|
33
|
+
name: 'deploy',
|
|
34
|
+
template: deployTemplate,
|
|
35
|
+
description: 'Deployment procedures',
|
|
36
|
+
}],
|
|
37
|
+
// Agent templates
|
|
38
|
+
['code-generator', {
|
|
39
|
+
type: 'agent',
|
|
40
|
+
name: 'code-generator',
|
|
41
|
+
template: codeGeneratorTemplate,
|
|
42
|
+
description: 'Generates code following project instructions',
|
|
43
|
+
}],
|
|
44
|
+
['code-reviewer', {
|
|
45
|
+
type: 'agent',
|
|
46
|
+
name: 'code-reviewer',
|
|
47
|
+
template: codeReviewerTemplate,
|
|
48
|
+
description: 'Reviews code against instructions',
|
|
49
|
+
}],
|
|
50
|
+
['task-planner', {
|
|
51
|
+
type: 'agent',
|
|
52
|
+
name: 'task-planner',
|
|
53
|
+
template: taskPlannerTemplate,
|
|
54
|
+
description: 'Breaks features into task files',
|
|
55
|
+
}],
|
|
56
|
+
['bug-fixer', {
|
|
57
|
+
type: 'agent',
|
|
58
|
+
name: 'bug-fixer',
|
|
59
|
+
template: bugFixerTemplate,
|
|
60
|
+
description: 'Diagnoses and fixes bugs',
|
|
61
|
+
}],
|
|
62
|
+
// File templates
|
|
63
|
+
['task', {
|
|
64
|
+
type: 'task',
|
|
65
|
+
name: 'task',
|
|
66
|
+
template: taskTemplate,
|
|
67
|
+
description: 'Task file template',
|
|
68
|
+
}],
|
|
69
|
+
['skill', {
|
|
70
|
+
type: 'skill',
|
|
71
|
+
name: 'skill',
|
|
72
|
+
template: skillTemplate,
|
|
73
|
+
description: 'Skill file template',
|
|
74
|
+
}],
|
|
75
|
+
]);
|
|
76
|
+
export function getTemplate(name) {
|
|
77
|
+
return templates.get(name);
|
|
78
|
+
}
|
|
79
|
+
export function listTemplates(type) {
|
|
80
|
+
return Array.from(templates.values()).filter((t) => !type || t.type === type);
|
|
81
|
+
}
|
|
82
|
+
export function renderTemplate(name, data) {
|
|
83
|
+
const entry = getTemplate(name);
|
|
84
|
+
if (!entry) {
|
|
85
|
+
throw new Error(`Template not found: ${name}`);
|
|
86
|
+
}
|
|
87
|
+
return compileTemplate(entry.template, data);
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/templates/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAqB,MAAM,aAAa,CAAC;AACjE,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAW/D,MAAM,SAAS,GAA+B,IAAI,GAAG,CAAC;IACpD,wBAAwB;IACxB,CAAC,cAAc,EAAE;YACf,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,cAAc;YACpB,QAAQ,EAAE,oBAAoB;YAC9B,WAAW,EAAE,kCAAkC;SAChD,CAAC;IACF,CAAC,OAAO,EAAE;YACR,IAAI,EAAE,aAAa;YACnB,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AAI,EAAE,OAAO;YACb,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,aAAa;YACvB,WAAW,EAAE,qBAAqB;SACnC,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAmB;IAC/C,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAChF,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,IAAkB;IAC7D,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,eAAe,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const fsUtils: {
|
|
2
|
+
exists: (filePath: string) => boolean;
|
|
3
|
+
readFile: (filePath: string) => string;
|
|
4
|
+
writeFile: (filePath: string, content: string) => void;
|
|
5
|
+
readJSON: (filePath: string) => Record<string, unknown>;
|
|
6
|
+
writeJSON: (filePath: string, data: Record<string, unknown>) => void;
|
|
7
|
+
listFiles: (dirPath: string, ext?: string) => string[];
|
|
8
|
+
mkdir: (dirPath: string) => void;
|
|
9
|
+
isDirectory: (filePath: string) => boolean;
|
|
10
|
+
removeFile: (filePath: string) => void;
|
|
11
|
+
moveFile: (oldPath: string, newPath: string) => void;
|
|
12
|
+
copyFile: (src: string, dest: string) => void;
|
|
13
|
+
copyDir: (srcDir: string, destDir: string) => void;
|
|
14
|
+
getProjectRoot: (startPath?: string) => string;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=fs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO;uBACG,MAAM,KAAG,OAAO;yBAId,MAAM,KAAG,MAAM;0BAId,MAAM,WAAW,MAAM,KAAG,IAAI;yBAQ/B,MAAM,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;0BAK/B,MAAM,QAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,IAAI;yBAQ7C,MAAM,QAAQ,MAAM,KAAG,MAAM,EAAE;qBAanC,MAAM,KAAG,IAAI;4BAMN,MAAM,KAAG,OAAO;2BAKjB,MAAM,KAAG,IAAI;wBAMhB,MAAM,WAAW,MAAM,KAAG,IAAI;oBAQlC,MAAM,QAAQ,MAAM,KAAG,IAAI;sBAQzB,MAAM,WAAW,MAAM,KAAG,IAAI;iCASpB,MAAM,KAAmB,MAAM;CAU9D,CAAC"}
|
package/dist/utils/fs.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
export const fsUtils = {
|
|
4
|
+
exists: (filePath) => {
|
|
5
|
+
return fs.existsSync(filePath);
|
|
6
|
+
},
|
|
7
|
+
readFile: (filePath) => {
|
|
8
|
+
return fs.readFileSync(filePath, 'utf-8');
|
|
9
|
+
},
|
|
10
|
+
writeFile: (filePath, content) => {
|
|
11
|
+
const dir = path.dirname(filePath);
|
|
12
|
+
if (!fs.existsSync(dir)) {
|
|
13
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
14
|
+
}
|
|
15
|
+
fs.writeFileSync(filePath, content, 'utf-8');
|
|
16
|
+
},
|
|
17
|
+
readJSON: (filePath) => {
|
|
18
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
19
|
+
return JSON.parse(content);
|
|
20
|
+
},
|
|
21
|
+
writeJSON: (filePath, data) => {
|
|
22
|
+
const dir = path.dirname(filePath);
|
|
23
|
+
if (!fs.existsSync(dir)) {
|
|
24
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
25
|
+
}
|
|
26
|
+
fs.writeFileSync(filePath, JSON.stringify(data, null, 2), 'utf-8');
|
|
27
|
+
},
|
|
28
|
+
listFiles: (dirPath, ext) => {
|
|
29
|
+
if (!fs.existsSync(dirPath))
|
|
30
|
+
return [];
|
|
31
|
+
return fs
|
|
32
|
+
.readdirSync(dirPath)
|
|
33
|
+
.filter((file) => {
|
|
34
|
+
if (ext) {
|
|
35
|
+
return file.endsWith(ext);
|
|
36
|
+
}
|
|
37
|
+
return true;
|
|
38
|
+
})
|
|
39
|
+
.map((file) => path.join(dirPath, file));
|
|
40
|
+
},
|
|
41
|
+
mkdir: (dirPath) => {
|
|
42
|
+
if (!fs.existsSync(dirPath)) {
|
|
43
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
isDirectory: (filePath) => {
|
|
47
|
+
if (!fs.existsSync(filePath))
|
|
48
|
+
return false;
|
|
49
|
+
return fs.statSync(filePath).isDirectory();
|
|
50
|
+
},
|
|
51
|
+
removeFile: (filePath) => {
|
|
52
|
+
if (fs.existsSync(filePath)) {
|
|
53
|
+
fs.unlinkSync(filePath);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
moveFile: (oldPath, newPath) => {
|
|
57
|
+
const dir = path.dirname(newPath);
|
|
58
|
+
if (!fs.existsSync(dir)) {
|
|
59
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
60
|
+
}
|
|
61
|
+
fs.renameSync(oldPath, newPath);
|
|
62
|
+
},
|
|
63
|
+
copyFile: (src, dest) => {
|
|
64
|
+
const dir = path.dirname(dest);
|
|
65
|
+
if (!fs.existsSync(dir)) {
|
|
66
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
67
|
+
}
|
|
68
|
+
fs.copyFileSync(src, dest);
|
|
69
|
+
},
|
|
70
|
+
copyDir: (srcDir, destDir) => {
|
|
71
|
+
if (!fs.existsSync(srcDir)) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
75
|
+
fs.cpSync(srcDir, destDir, { recursive: true, force: true });
|
|
76
|
+
},
|
|
77
|
+
getProjectRoot: (startPath = process.cwd()) => {
|
|
78
|
+
let current = startPath;
|
|
79
|
+
while (current !== path.dirname(current)) {
|
|
80
|
+
if (fs.existsSync(path.join(current, 'package.json'))) {
|
|
81
|
+
return current;
|
|
82
|
+
}
|
|
83
|
+
current = path.dirname(current);
|
|
84
|
+
}
|
|
85
|
+
return startPath;
|
|
86
|
+
},
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=fs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AAGxB,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB,MAAM,EAAE,CAAC,QAAgB,EAAW,EAAE;QAClC,OAAO,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;IAED,QAAQ,EAAE,CAAC,QAAgB,EAAU,EAAE;QACnC,OAAO,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,SAAS,EAAE,CAAC,QAAgB,EAAE,OAAe,EAAQ,EAAE;QACnD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACnC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;YACtB,EAAE,CAAC,SAAS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EAAE,IAAI,EAAE,CAAC,CAAC;QAC3C,CAAC;QACD,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAC/B,CAAC;IAED,OAAO,EAAE,CAAC,MAAc,EAAE,OAAe,EAAQ,EAAE;QAC/C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;YACzB,OAAO;QACX,CAAC;QAED,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3C,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,cAAc,EAAE,CAAC,YAAoB,OAAO,CAAC,GAAG,EAAE,EAAU,EAAE;QAC1D,IAAI,OAAO,GAAG,SAAS,CAAC;QACxB,OAAO,OAAO,KAAK,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACvC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;gBACpD,OAAO,OAAO,CAAC;YACnB,CAAC;YACD,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const logger: {
|
|
2
|
+
success: (message: string) => void;
|
|
3
|
+
error: (message: string) => void;
|
|
4
|
+
warn: (message: string) => void;
|
|
5
|
+
info: (message: string) => void;
|
|
6
|
+
dim: (message: string) => void;
|
|
7
|
+
bold: (message: string) => void;
|
|
8
|
+
section: (title: string) => void;
|
|
9
|
+
spinner: (message: string) => {
|
|
10
|
+
succeed: () => void;
|
|
11
|
+
fail: () => void;
|
|
12
|
+
stop: () => void;
|
|
13
|
+
};
|
|
14
|
+
newline: () => void;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,MAAM;uBACE,MAAM;qBAMR,MAAM;oBAMP,MAAM;oBAMN,MAAM;mBAMP,MAAM;oBAIL,MAAM;qBAIL,MAAM;uBAKJ,MAAM;;;;;;CA4B1B,CAAC"}
|