
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@papaoloba/nightly-code-orchestrator
Advanced tools
Automated 8-hour coding sessions using Claude Code - a comprehensive npm package that enables unattended development work.
The Nightly Code Orchestrator transforms your development workflow by automating coding sessions while you sleep. Define tasks in simple YAML files, and wake up to completed features, fixed bugs, and comprehensive reports.
# Install globally for CLI access
npm install -g @papaoloba/nightly-code-orchestrator
# Or install locally in your project
npm install --save-dev @papaoloba/nightly-code-orchestrator
# Navigate to your project directory
cd your-project
# Initialize configuration
nightly-code init
# Edit the generated configuration files
code nightly-code.yaml nightly-tasks.yaml
# Validate your setup
nightly-code validate
# Test with a dry run
nightly-code run --dry-run
# Schedule automated sessions
nightly-code schedule
# Navigate to your project directory
cd your-project
# Initialize configuration using npx
npx nightly-code init
# Edit the generated configuration files
code nightly-code.yaml nightly-tasks.yaml
# Validate your setup
npx nightly-code validate
# Test with a dry run
npx nightly-code run --dry-run
# Schedule automated sessions
npx nightly-code schedule
Note: When installed locally, you can either:
npx nightly-code
to run commandspackage.json
:
{
"scripts": {
"nightly:init": "nightly-code init",
"nightly:run": "nightly-code run",
"nightly:validate": "nightly-code validate"
}
}
Then run: npm run nightly:init
nightly-code.yaml
)session:
max_duration: 28800 # 8 hours in seconds
time_zone: "UTC"
max_concurrent_tasks: 1
checkpoint_interval: 300 # 5 minutes
project:
root_directory: "./"
package_manager: "npm"
test_command: "npm test"
lint_command: "npm run lint"
build_command: "npm run build"
setup_commands:
- "npm install"
git:
branch_prefix: "nightly/"
auto_push: true
create_pr: true
pr_template: ".github/pull_request_template.md"
notifications:
email:
enabled: false
# smtp_host: "smtp.gmail.com"
# smtp_user: "your-email@gmail.com"
# to: ["team@company.com"]
slack:
enabled: false
# webhook_url: "https://hooks.slack.com/services/..."
# SuperClaude Framework integration
superclaude:
enabled: false # Enable automatic prompt optimization
planning_mode: intelligent
execution_mode: assisted
task_management: hierarchical
integration_level: deep
nightly-tasks.yaml
)version: "1.0"
tasks:
- id: "implement-user-auth"
type: "feature"
priority: 8
title: "Implement User Authentication System"
requirements: |
Implement a complete user authentication system with:
1. User registration with email verification
2. Login with JWT tokens
3. Password reset functionality
4. Protected routes middleware
Use bcrypt for password hashing and follow security best practices.
acceptance_criteria:
- "User can register and receive verification email"
- "Login returns valid JWT token"
- "Protected routes reject unauthenticated requests"
- "Password reset flow works end-to-end"
- "All security tests pass"
minimum_duration: 180 # Optional: Forces iterative prompting for at least 3 hours
dependencies: []
tags: ["backend", "security", "authentication"]
files_to_modify:
- "src/auth/"
- "src/middleware/"
- "test/auth/"
custom_validation:
script: "./scripts/validate-auth.js"
timeout: 300
enabled: true
- id: "fix-memory-leak"
type: "bugfix"
priority: 9
title: "Fix Memory Leak in Data Processing"
requirements: |
Investigate and fix memory leak in data processing module.
Memory usage increases by ~50MB/hour during operation.
Issue appears related to event listeners not being cleaned up.
acceptance_criteria:
- "Memory usage remains stable during extended operation"
- "Event listeners are properly cleaned up"
- "Unit tests verify proper cleanup"
- "Application can run 24+ hours without issues"
minimum_duration: 90 # Optional: Forces iterative prompting for at least 90 minutes
dependencies: []
tags: ["bugfix", "performance", "memory"]
files_to_modify:
- "src/processors/"
enabled: true
nightly-code init
Initialize configuration in the current repository.
# If installed globally
nightly-code init
nightly-code init --force --template python
# If installed locally
npx nightly-code init
npx nightly-code init --force --template python
Options:
--force, -f
- Overwrite existing configuration--template, -t
- Use predefined template (node, python, go)nightly-code run
Execute a coding session manually.
# If installed globally
nightly-code run
nightly-code run --max-duration 240 --dry-run
nightly-code run --resume checkpoint-123
# If installed locally
npx nightly-code run
npx nightly-code run --max-duration 240 --dry-run
npx nightly-code run --resume checkpoint-123
Options:
--config, -c
- Path to configuration file--tasks, -t
- Path to tasks file--max-duration
- Maximum duration in minutes--dry-run
- Validate without executing--resume
- Resume from checkpointnightly-code schedule
Set up automated scheduling.
# If installed globally
nightly-code schedule
nightly-code schedule --cron "0 22 * * *" --timezone "America/New_York"
# If installed locally
npx nightly-code schedule
npx nightly-code schedule --cron "0 22 * * *" --timezone "America/New_York"
Options:
--cron, -c
- Cron expression for scheduling--timezone, -t
- Timezone for scheduling--dry-run
- Show what would be schedulednightly-code status
Check the last session results.
# If installed globally
nightly-code status
nightly-code status --verbose --json
# If installed locally
npx nightly-code status
npx nightly-code status --verbose --json
Options:
--verbose, -v
- Show detailed information--json
- Output in JSON formatnightly-code validate
Validate current configuration and environment.
# If installed globally
nightly-code validate
nightly-code validate --fix
# If installed locally
npx nightly-code validate
npx nightly-code validate --fix
Options:
--config, -c
- Path to configuration file--tasks, -t
- Path to tasks file--fix
- Attempt to fix common issuesnightly-code describe
Describe work to be done in natural language and generate optimized nightly-tasks.yaml
file.
# If installed globally
nightly-code describe "Implement user authentication with email verification"
nightly-code describe --interactive
nightly-code describe --file tasks.txt
# If installed locally
npx nightly-code describe "Fix the memory leak in data processing"
npx nightly-code describe --interactive
Options:
--output, -o
- Output file path (default: nightly-tasks.yaml)--interactive, -i
- Interactive mode for entering multiple tasks--file, -f
- Read descriptions from a text file--append
- Append to existing tasks file instead of overwritingExamples:
Simple task description:
nightly-code describe "Fix the critical bug in payment processing"
Complex feature with details:
nightly-code describe "Implement user authentication system with:
- Email and password registration
- JWT token generation
- Password reset functionality
- Email verification
- Protected routes middleware"
Load multiple tasks from file:
nightly-code describe --file task-descriptions.txt
Interactive mode:
nightly-code describe --interactive
The AI will automatically:
nightly-code report
Generate and view session reports.
# If installed globally
nightly-code report
nightly-code report 2024-01-15 --format markdown
nightly-code report --last 5 --output report.json
# If installed locally
npx nightly-code report
npx nightly-code report 2024-01-15 --format markdown
npx nightly-code report --last 5 --output report.json
Options:
--format, -f
- Output format (json, markdown, table)--output, -o
- Output file path--last
- Show last N sessionsconst { Orchestrator, TaskManager } = require('@papaoloba/nightly-code-orchestrator');
// Create orchestrator instance
const orchestrator = new Orchestrator({
configPath: 'custom-config.yaml',
tasksPath: 'custom-tasks.yaml',
maxDuration: 14400 // 4 hours
});
// Run session
orchestrator.run()
.then(result => {
console.log(`Session completed: ${result.completedTasks}/${result.totalTasks} tasks`);
})
.catch(error => {
console.error('Session failed:', error);
});
// Work with tasks directly
const taskManager = new TaskManager();
const tasks = await taskManager.loadTasks();
const ordered = await taskManager.resolveDependencies(tasks);
When all scheduled tasks complete successfully but time remains in the session, the orchestrator automatically triggers general code improvement tasks. This feature maximizes the value of your 8-hour coding sessions.
/sc:improve
command when available, falls back to standard improvement promptsWhen SuperClaude is enabled, automatic improvements use the optimized command:
/sc:improve --scope project --focus quality --iterative --validate
This leverages the SuperClaude framework's intelligent analysis and improvement patterns.
Automatic improvements can be controlled via configuration:
# nightly-code.yaml
session:
max_duration: 28800 # 8 hours
auto_improvements: true # Enable automatic improvements (default: true)
min_improvement_time: 300 # Minimum time required (5 minutes default)
superclaude:
enabled: true # Enable SuperClaude for optimized improvements
In dry run mode, automatic improvements are logged but not executed:
npx nightly-code --dry-run
# Shows what improvements would be made without executing them
Create custom validation scripts for specific requirements:
// scripts/validate-auth.js
const { spawn } = require('child_process');
async function validateAuth() {
console.log('Running authentication validation...');
// Run security audit
const audit = spawn('npm', ['audit', '--audit-level', 'high']);
await new Promise((resolve, reject) => {
audit.on('close', code => code === 0 ? resolve() : reject());
});
// Run auth-specific tests
const tests = spawn('npm', ['test', '--', '--grep', 'auth']);
await new Promise((resolve, reject) => {
tests.on('close', code => code === 0 ? resolve() : reject());
});
console.log('Authentication validation passed!');
}
validateAuth().catch(error => {
console.error('Validation failed:', error);
process.exit(1);
});
# .github/workflows/nightly-code.yml
name: Nightly Code Session
on:
schedule:
- cron: '0 2 * * *' # 2 AM UTC daily
workflow_dispatch:
jobs:
nightly-code:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install Nightly Code
run: npm install -g @papaoloba/nightly-code-orchestrator
- name: Run Nightly Code Session
run: nightly-code run --max-duration 240
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Dockerfile.nightly
FROM node:18-alpine
# Install system dependencies
RUN apk add --no-cache git openssh-client
# Install Claude Code and Nightly Code
RUN npm install -g claude-code @papaoloba/nightly-code-orchestrator
# Set up working directory
WORKDIR /workspace
# Copy configuration
COPY nightly-code.yaml nightly-tasks.yaml ./
# Set up git configuration
RUN git config --global user.name "Nightly Code Bot" && \
git config --global user.email "nightly@example.com"
# Run nightly session
CMD ["nightly-code", "run"]
For implementing new functionality:
- id: "add-payment-integration"
type: "feature"
priority: 7
title: "Add Stripe Payment Integration"
requirements: |
Integrate Stripe payment processing with:
- Payment form with validation
- Webhook handling for payment events
- Error handling and retry logic
- Invoice generation
acceptance_criteria:
- "Payment form accepts credit cards"
- "Successful payments create invoices"
- "Failed payments show appropriate errors"
- "Webhook events are processed correctly"
minimum_duration: 240
tags: ["backend", "payments", "integration"]
For resolving issues:
- id: "fix-search-performance"
type: "bugfix"
priority: 8
title: "Fix Slow Search Performance"
requirements: |
Search queries are taking 5+ seconds on large datasets.
Investigation shows missing database indexes and inefficient queries.
Root causes:
- No index on search columns
- N+1 query problem in results
- No query result caching
acceptance_criteria:
- "Search completes in under 500ms"
- "Database queries are optimized"
- "Caching reduces repeat query time"
minimum_duration: 120
tags: ["bugfix", "performance", "database"]
For improving code structure:
- id: "extract-service-layer"
type: "refactor"
priority: 4
title: "Extract Business Logic to Service Layer"
requirements: |
Controllers have become too large with business logic mixed in.
Extract to dedicated service classes for better separation of concerns.
Goals:
- Thin controllers focused on HTTP concerns
- Testable service classes
- Consistent error handling
- Improved code organization
acceptance_criteria:
- "Controllers are under 100 lines each"
- "Business logic is in service classes"
- "Service classes have 90%+ test coverage"
- "All existing functionality still works"
minimum_duration: 180
tags: ["refactor", "architecture"]
Nightly Code uses a structured commit message convention for tracking task completion. This provides better integration with standard git workflows and improved searchability.
<type>(<scope>): <description> [task:<task-id>]
<body>
Task-ID: <task-id>
Task-Title: <full task title>
Task-Type: <feature|bugfix|refactor|test|docs>
Task-Status: completed
Task-Duration: <duration in seconds>
Task-Session: <session-id>
Task-Date: <ISO timestamp>
Single Commit Task:
feat(auth): implement user login [task:auth-001]
Implemented JWT-based authentication with refresh tokens.
Task-ID: auth-001
Task-Title: Implement user authentication system
Task-Type: feature
Task-Status: completed
Task-Duration: 3600
Task-Session: session-2024-01-20-120000
Task-Date: 2024-01-20T12:00:00Z
Multi-Commit Task:
# Progress commits
feat(ui): add dashboard layout [task:ui-005] [1/3]
feat(ui): implement dashboard widgets [task:ui-005] [2/3]
# Final commit
feat(ui): complete dashboard implementation [task:ui-005] [3/3]
Finalized dashboard with all widgets and responsive design.
Task-ID: ui-005
Task-Title: Create user dashboard with analytics widgets
Task-Type: feature
Task-Status: completed
Task-Duration: 7200
Task-Session: session-2024-01-20-090000
Task-Date: 2024-01-20T11:00:00Z
# Find all task completions
git log --grep="\[task:" --oneline
# Find specific task
git log --grep="\[task:auth-001\]"
# List completed tasks with details
git log --grep="Task-Status: completed" --pretty=format:"%h %s %ad" --date=short
# Export task report
git log --grep="Task-Status: completed" --pretty=format:"%h|%s|%ad" --date=short > tasks.csv
Install the commit-msg hook to validate task commits:
# Copy hook to your git directory
cp node_modules/@papaoloba/nightly-code-orchestrator/hooks/commit-msg .git/hooks/
chmod +x .git/hooks/commit-msg
The hook validates:
Enable sandbox mode for additional security:
security:
sandbox_mode: true
allowed_commands:
- "npm"
- "node"
- "git"
blocked_patterns:
- "rm -rf"
- "sudo"
- "curl"
max_file_size: 10485760 # 10MB
Restrict file modifications:
tasks:
- id: "safe-task"
files_to_modify:
- "src/components/" # Only allow changes in specific directories
- "test/"
All commands are validated before execution:
The orchestrator continuously monitors:
Automatic checkpoints every 5 minutes (configurable) include:
Each session tracks:
# Install Claude Code
npm install -g claude-code
# Verify installation
claude-code --version
# Check configuration syntax
# If installed globally
nightly-code validate
# If installed locally
npx nightly-code validate
# Fix common issues automatically
# If installed globally
nightly-code validate --fix
# If installed locally
npx nightly-code validate --fix
# Initialize git repository
git init
git add .
git commit -m "Initial commit"
Check for circular dependencies:
tasks:
- id: "task-a"
dependencies: ["task-b"] # task-a depends on task-b
- id: "task-b"
dependencies: ["task-a"] # task-b depends on task-a (circular!)
Nightly Code now supports intelligent Git branching that respects task dependencies. When a task depends on another task, it will automatically branch from the dependency's branch instead of main, ensuring all dependent code is available.
Example workflow:
main
└─ task/setup-db (Task A)
└─ task/create-api (Task B depends on A)
└─ task/add-tests (Task C depends on B)
Control dependency branching behavior in nightly-code.yaml
:
git:
# Enable branching from dependency branches (default: true)
dependency_aware_branching: true
# Auto-merge tasks that have dependents (default: false)
merge_dependency_chains: false
# Fail if dependency branches are missing (default: false)
strict_dependency_checking: false
tasks:
- id: "setup-database"
type: "feature"
title: "Set up database schema"
requirements: "Create initial database tables and migrations"
dependencies: [] # No dependencies - branches from main
- id: "create-api"
type: "feature"
title: "Create REST API"
requirements: "Implement CRUD endpoints for database entities"
dependencies: ["setup-database"] # Branches from setup-database branch
- id: "add-authentication"
type: "feature"
title: "Add authentication"
requirements: "Implement JWT authentication for API"
dependencies: ["create-api"] # Branches from create-api branch
- id: "add-tests"
type: "test"
title: "Add integration tests"
requirements: "Test API endpoints with authentication"
dependencies: ["create-api", "add-authentication"] # Branches from add-authentication (last dependency)
Enable detailed logging:
# Set log level
export NIGHTLY_CODE_LOG_LEVEL=debug
# Run with verbose output
# If installed globally
nightly-code run --verbose
# If installed locally
npx nightly-code run --verbose
Logs are stored in .nightly-code/logs/
:
nightly-code.log
- General application logssessions.log
- Detailed session logsscheduler.log
- Scheduling and cron logsnightly-code validate
after changesWe welcome contributions! Please see our Contributing Guide for details.
# Clone the repository
git clone https://github.com/papaoloba/nightly-code-orchestrator.git
cd nightly-code-orchestrator
# Install dependencies
npm install
# Run tests
npm test
# Run with watch mode
npm run test:watch
# Check linting
npm run lint
# Build the project
npm run build
# Run all tests
npm test
# Run tests with coverage
npm run test:coverage
# Run specific test file
npm test -- orchestrator.test.js
# Run tests in watch mode
npm run test:watch
MIT License - see LICENSE file for details.
See CHANGELOG.md for version history and updates.
Transform your development workflow with automated coding sessions
Made with ❤️ by the Paolo Barbato
FAQs
Automated 8-hour coding sessions using Claude Code
We found that @papaoloba/nightly-code-orchestrator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.