bun-init — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited bun-init (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
You are assisting with initializing a new Bun project. Follow these steps to create a well-structured project with optimal configurations.
First, verify Bun is installed:
bun --versionIf Bun is not installed, provide installation instructions for the user's platform.
Ask the user which type of project they want to create:
Execute the initialization command:
bun init -yThis creates:
package.json with Bun-optimized scriptstsconfig.json with recommended TypeScript settingsindex.ts as the entry pointREADME.md with basic project infoRead the generated tsconfig.json and enhance it based on project type:
For CLI Tools:
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"types": ["bun-types"],
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"allowImportingTsExtensions": true,
"noEmit": true
}
}For Web Apps:
{
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"module": "ESNext",
"moduleResolution": "bundler",
"jsx": "react-jsx",
"types": ["bun-types"],
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"allowImportingTsExtensions": true,
"noEmit": true
}
}For API Servers:
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"types": ["bun-types"],
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"allowImportingTsExtensions": true,
"noEmit": true,
"paths": {
"@/*": ["./src/*"]
}
}
}For Libraries:
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"types": ["bun-types"],
"strict": true,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"allowImportingTsExtensions": true,
"noEmit": true
}
}Generate appropriate directory structure and files:
CLI Tool:
project/
├── src/
│ ├── index.ts # Main CLI entry point
│ ├── commands/ # Command handlers
│ └── utils/ # Shared utilities
├── tests/
│ └── index.test.ts
├── package.json
├── tsconfig.json
├── .gitignore
├── .env.example
└── README.mdCreate src/index.ts:
#!/usr/bin/env bun
console.log("Hello from Bun CLI!");
// Example: Parse command line arguments
const args = process.argv.slice(2);
console.log("Arguments:", args);Update package.json to add bin field:
{
"bin": {
"your-cli-name": "./src/index.ts"
}
}Web App:
project/
├── src/
│ ├── index.tsx # App entry point
│ ├── components/ # React components
│ ├── styles/ # CSS/styles
│ └── utils/ # Utilities
├── public/
│ └── index.html
├── tests/
├── package.json
├── tsconfig.json
├── .gitignore
├── .env.example
└── README.mdAPI Server:
project/
├── src/
│ ├── index.ts # Server entry point
│ ├── routes/ # Route handlers
│ ├── middleware/ # Express/Hono middleware
│ ├── services/ # Business logic
│ └── types/ # TypeScript types
├── tests/
├── package.json
├── tsconfig.json
├── .gitignore
├── .env.example
└── README.mdCreate src/index.ts:
const server = Bun.serve({
port: 3000,
fetch(request) {
return new Response("Welcome to Bun!");
},
});
console.log(`Server running at http://localhost:${server.port}`);Library:
project/
├── src/
│ ├── index.ts # Main export
│ └── types.ts # Type definitions
├── tests/
├── package.json
├── tsconfig.json
├── .gitignore
└── README.mdGenerate a comprehensive .gitignore:
# Bun
node_modules
bun.lockb
*.bun
# Environment
.env
.env.local
.env.*.local
# Build outputs
dist/
build/
*.tsbuildinfo
# Logs
logs
*.log
npm-debug.log*
# OS
.DS_Store
Thumbs.db
# IDE
.vscode/
.idea/
*.swp
*.swo
*~
# Test coverage
coverage/
.nyc_output/Create .env.example:
# Application
NODE_ENV=development
PORT=3000
# Add your environment variables here
# DATABASE_URL=
# API_KEY=Add project-type-specific scripts:
CLI Tool:
{
"scripts": {
"dev": "bun run src/index.ts",
"test": "bun test",
"lint": "bun run --bun eslint src",
"typecheck": "bun run --bun tsc --noEmit"
}
}Web App:
{
"scripts": {
"dev": "bun run --hot src/index.tsx",
"build": "bun build src/index.tsx --outdir=dist --minify",
"test": "bun test",
"typecheck": "bun run --bun tsc --noEmit"
}
}API Server:
{
"scripts": {
"dev": "bun run --hot src/index.ts",
"start": "bun run src/index.ts",
"test": "bun test",
"typecheck": "bun run --bun tsc --noEmit"
}
}Library:
{
"scripts": {
"build": "bun build src/index.ts --outdir=dist --minify --sourcemap=external",
"test": "bun test",
"typecheck": "bun run --bun tsc --noEmit",
"prepublishOnly": "bun run build && bun test"
}
}Suggest installing common dependencies based on project type:
CLI Tool:
bun add commander chalk ora
bun add -d @types/nodeWeb App:
bun add react react-dom
bun add -d @types/react @types/react-domAPI Server:
bun add hono
bun add -d @types/nodeLibrary:
# No default dependencies - user will add as neededCreate a basic test file in tests/:
import { describe, expect, test } from "bun:test";
describe("Initial test", () => {
test("basic assertion", () => {
expect(1 + 1).toBe(2);
});
});After completing the setup, provide the user with:
.env.example to .env and configurebun install if dependencies were suggestedbun dev to start developmentbun test to verify tests work"moduleResolution": "bundler" for Bun's native resolution"types": ["bun-types"]"noEmit": true since Bun runs TypeScript directly"allowImportingTsExtensions": true for .ts importsIf user wants workspaces (monorepo):
Add to package.json:
{
"workspaces": ["packages/*"]
}If user wants path aliases:
Add to tsconfig.json:
{
"compilerOptions": {
"paths": {
"@/*": ["./src/*"],
"@components/*": ["./src/components/*"]
}
}
}If user wants JSX without React:
Update tsconfig.json:
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "preact" // or other JSX runtime
}
}Once all files are created, inform the user that initialization is complete and provide a summary of:
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.