Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended'
],
parserOptions: {
ecmaVersion: 2022,
sourceType: 'module',
project: './tsconfig.json'
},
rules: {
'@typescript-eslint/explicit-function-return-type': 'warn',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'no-console': ['warn', { allow: ['warn', 'error'] }]
}
Comment on lines +16 to +17
Copy link

Copilot AI Dec 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The no-console ESLint rule allows 'warn' and 'error' but the codebase uses console.log extensively in examples/basic-usage.ts and the persist method uses console.error. While this is appropriate for the example file and audit logging, consider documenting the rationale for console usage or using a proper logging framework that can be configured for different environments.

Suggested change
'no-console': ['warn', { allow: ['warn', 'error'] }]
}
// Disallow general console usage in application code.
// We allow console.warn and console.error because:
// - console.error is used for audit/error logging where a logging framework
// may not be available (e.g. early bootstrapping, process-level failures).
// - console.warn is allowed for non-fatal operational warnings.
// For application-level logging, prefer a proper logging framework that can be
// configured per environment (e.g. debug levels, transports, formatting).
'no-console': ['warn', { allow: ['warn', 'error'] }]
},
// Examples and documentation snippets may use console.log freely for clarity.
// We disable the no-console rule for those files to avoid noisy warnings.
overrides: [
{
files: ['examples/basic-usage.ts'],
rules: {
'no-console': 'off'
}
}
]

Copilot uses AI. Check for mistakes.
};
117 changes: 117 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: CI/CD Pipeline

on:
push:
branches: [ main, develop, 'copilot/**' ]
pull_request:
branches: [ main, develop ]

jobs:
lint:
name: Lint Code
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint

test:
name: Run Tests
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm test -- --coverage

- name: Upload coverage
uses: codecov/codecov-action@v3
with:
files: ./coverage/lcov.info
fail_ci_if_error: false

build:
name: Build
runs-on: ubuntu-latest
needs: [lint, test]
permissions:
contents: read

steps:
- uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/

compliance-check:
name: Core Directive Compliance
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v4

- name: Check Core Directive exists
run: |
if [ ! -f "CORE_DIRECTIVE.md" ]; then
echo "Error: CORE_DIRECTIVE.md not found"
exit 1
fi
echo "✓ Core Directive found"

- name: Check architecture documentation
run: |
if [ ! -f "notes/ARCHITECTURE_DRAFT.md" ]; then
echo "Warning: ARCHITECTURE_DRAFT.md not found"
else
echo "✓ Architecture documentation found"
fi

- name: Verify no secrets in code
run: |
if grep -r "api[_-]key\|password\|secret" --include="*.ts" --include="*.js" src/ 2>/dev/null; then
echo "Warning: Potential secrets found in code"
else
echo "✓ No obvious secrets detected"
fi
Comment on lines +111 to +117
Copy link

Copilot AI Dec 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded secret detection grep pattern is too simplistic and will produce false positives. It will flag legitimate variable names like 'api_key_length' or comments mentioning 'password validation'. Consider using a dedicated secrets scanning tool like gitleaks or truffleHog, or at minimum, improve the pattern to match actual secret values (e.g., strings with high entropy, API key formats, etc.) rather than just variable names.

Copilot uses AI. Check for mistakes.
61 changes: 61 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Dependencies
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
package-lock.json
yarn.lock

# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
env/
venv/
ENV/
.venv

# Build outputs
dist/
build/
*.egg-info/
.eggs/
lib/
lib64/

# IDE
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store

# Testing
.coverage
.pytest_cache/
coverage/
*.cover
.hypothesis/
htmlcov/

# Logs
logs/
*.log

# Environment variables
.env
.env.local
.env.*.local

# Temporary files
tmp/
temp/
*.tmp
*.bak

# OS
.DS_Store
Thumbs.db
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 100,
"tabWidth": 2
}
153 changes: 153 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
# Contributing to Prime Security

Thank you for your interest in contributing to Prime Security (Under Pressure Looming)! This project implements a self-organizing, multi-agent security framework governed by the Core Directive.

## Core Directive Compliance

**All contributions must align with the [Core Directive](./CORE_DIRECTIVE.md).** This is the foundational, non-negotiable requirement for any code or documentation changes.

Before submitting:
1. Read the [Core Directive](./CORE_DIRECTIVE.md)
2. Review the [Architecture](./notes/ARCHITECTURE_DRAFT.md)
3. Understand the [Research Foundations](./UNDER_PRESSURE_LOOMING.md)

## Getting Started

1. Fork the repository
2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/Prime-security.git`
3. Install dependencies: `npm install`
4. Create a branch: `git checkout -b feature/your-feature-name`

## Development Workflow

### Building
```bash
npm run build
```

### Testing
```bash
npm test # Run all tests
npm run test:watch # Watch mode
npm run test:coverage # With coverage
```

### Linting
```bash
npm run lint # Check for issues
npm run lint:fix # Auto-fix issues
npm run format # Format with Prettier
```

## Code Standards

### TypeScript
- Use strict TypeScript
- Prefer interfaces over types where appropriate
- Document public APIs with JSDoc comments
- No `any` types (use `unknown` if truly needed)

### Security
- All inputs must be validated
- Use provided crypto primitives from `src/security/crypto.ts`
- Log security-relevant events via `auditLogger`
- Never commit secrets or credentials

### Testing
- Write tests for new functionality
- Maintain >70% code coverage
- Test both success and failure paths
- Use descriptive test names

### Documentation
- Update README.md if adding user-facing features
- Document architecture changes in `notes/ARCHITECTURE_DRAFT.md`
- Add inline comments for complex logic
- Update UNDER_PRESSURE_LOOMING.md for new research/tools

## Pull Request Process

1. **Create descriptive PR title**: `feat: add X` or `fix: resolve Y`
2. **Reference issues**: Link to related issues
3. **Pass CI checks**: All tests and lints must pass
4. **Core Directive compliance**: Automated check will verify
5. **Code review**: At least one approval required
6. **Documentation**: Update relevant docs

### PR Template
```markdown
## Description
Brief description of changes

## Core Directive Compliance
- [ ] Changes align with Core Directive principles
- [ ] Security-first approach maintained
- [ ] Audit logging added where appropriate
- [ ] No compromise of user data or privacy

## Testing
- [ ] Unit tests added/updated
- [ ] Integration tests pass
- [ ] Manual testing performed

## Documentation
- [ ] Code comments added
- [ ] README updated (if needed)
- [ ] Architecture doc updated (if needed)
```

## Module Development

When adding new modules:

1. **Register in Module Registry**
```typescript
import { registry, Module } from './registry';

const myModule: Module = {
name: 'my-module',
version: '0.1.0',
dependencies: ['core-security'],
init: async () => { /* ... */ },
start: async () => { /* ... */ },
stop: async () => { /* ... */ }
};

registry.register(myModule);
```

2. **Add to System Blueprint**
- Update `src/autonomic/dna.ts` if module is core

3. **Add Compliance Checks**
- Register checks in `src/governance/compliance.ts`

4. **Document in Architecture**
- Add module description to `notes/ARCHITECTURE_DRAFT.md`

## Security Vulnerabilities

**DO NOT** open public issues for security vulnerabilities.

Instead:
1. Email security concerns to project maintainers
2. Provide detailed description
3. Allow time for patch development
4. Coordinate disclosure timing

## Community Guidelines

- Be respectful and inclusive
- Assume good intentions
- Provide constructive feedback
- Help others learn and grow

## Questions?

- Check existing [Issues](https://github.com/dshvvvshr/Prime-security/issues)
- Review [Architecture Documentation](./notes/ARCHITECTURE_DRAFT.md)
- Read [Research Foundations](./UNDER_PRESSURE_LOOMING.md)

---

By contributing, you agree that your contributions will be licensed under the MIT License.
Loading
Loading