ai-project-boilerplate 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/LICENSE +21 -0
- package/README.md +60 -0
- package/bin/cli.js +111 -0
- package/package.json +23 -0
- package/template/.ai-stage +1 -0
- package/template/AI_INSTRUCTIONS.md +32 -0
- package/template/CHANGELOG.md +4 -0
- package/template/CLAUDE.md +1 -0
- package/template/README.md +1 -0
- package/template/docs/architecture.md +34 -0
- package/template/docs/deployment.md +31 -0
- package/template/docs/planning.md +31 -0
- package/template/docs/testing.md +28 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Jayden Liang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# ai-project-boilerplate
|
|
2
|
+
|
|
3
|
+
CLI to scaffold AI-collaborated projects with stage-based AI instruction files.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g ai-project-boilerplate
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
ai-project <project-name>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Creates a new directory with the following structure:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
<project-name>/
|
|
21
|
+
AI_INSTRUCTIONS.md — AI router (source of truth for all AI tools)
|
|
22
|
+
CLAUDE.md — Claude Code entry (@imports AI_INSTRUCTIONS.md)
|
|
23
|
+
.ai-stage — current stage, tracked per branch
|
|
24
|
+
CHANGELOG.md
|
|
25
|
+
README.md
|
|
26
|
+
docs/
|
|
27
|
+
planning.md — PLANNING stage
|
|
28
|
+
architecture.md — CODING stage
|
|
29
|
+
testing.md — TESTING stage
|
|
30
|
+
deployment.md — DEPLOY stage
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## How it works
|
|
34
|
+
|
|
35
|
+
Each AI session, the AI reads only `AI_INSTRUCTIONS.md` + the one doc for the current stage.
|
|
36
|
+
Stage is stored in `.ai-stage` (one line) so it travels with the branch and causes minimal merge conflicts.
|
|
37
|
+
|
|
38
|
+
### Stages
|
|
39
|
+
|
|
40
|
+
| Stage | Doc | Purpose |
|
|
41
|
+
|-------|-----|---------|
|
|
42
|
+
| PLANNING | `docs/planning.md` | Goals, requirements, decisions |
|
|
43
|
+
| CODING | `docs/architecture.md` | Structure, conventions, commands |
|
|
44
|
+
| TESTING | `docs/testing.md` | Test strategy, coverage rules |
|
|
45
|
+
| DEPLOY | `docs/deployment.md` | Env vars, deploy steps, rollback |
|
|
46
|
+
|
|
47
|
+
### Updating the stage
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
echo "CODING" > .ai-stage
|
|
51
|
+
git add .ai-stage && git commit -m "chore: advance stage to CODING"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Version check
|
|
55
|
+
|
|
56
|
+
Every invocation checks npm for a newer version and prints an upgrade prompt if one exists.
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const https = require("https");
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
const path = require("path");
|
|
6
|
+
|
|
7
|
+
const REPO = "JaydenLiang/ai-project-boilerplate";
|
|
8
|
+
const CURRENT_VERSION = require("../package.json").version;
|
|
9
|
+
|
|
10
|
+
function fetchLatestVersion() {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
const url = `https://registry.npmjs.org/ai-project-boilerplate/latest`;
|
|
13
|
+
https
|
|
14
|
+
.get(url, { headers: { "User-Agent": "ai-project-boilerplate-cli" } }, (res) => {
|
|
15
|
+
let data = "";
|
|
16
|
+
res.on("data", (chunk) => (data += chunk));
|
|
17
|
+
res.on("end", () => {
|
|
18
|
+
try {
|
|
19
|
+
resolve(JSON.parse(data).version);
|
|
20
|
+
} catch {
|
|
21
|
+
resolve(null);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
})
|
|
25
|
+
.on("error", () => resolve(null));
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function compareVersions(a, b) {
|
|
30
|
+
const pa = a.split(".").map(Number);
|
|
31
|
+
const pb = b.split(".").map(Number);
|
|
32
|
+
for (let i = 0; i < 3; i++) {
|
|
33
|
+
if (pa[i] > pb[i]) return 1;
|
|
34
|
+
if (pa[i] < pb[i]) return -1;
|
|
35
|
+
}
|
|
36
|
+
return 0;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function checkForUpdate() {
|
|
40
|
+
const latest = await fetchLatestVersion();
|
|
41
|
+
if (latest && compareVersions(latest, CURRENT_VERSION) > 0) {
|
|
42
|
+
console.log(`\n Update available: ${CURRENT_VERSION} → ${latest}`);
|
|
43
|
+
console.log(` Run to update: npm install -g ai-project-boilerplate\n`);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function copyTemplate(src, dest) {
|
|
50
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
51
|
+
for (const entry of entries) {
|
|
52
|
+
const srcPath = path.join(src, entry.name);
|
|
53
|
+
const destPath = path.join(dest, entry.name);
|
|
54
|
+
if (entry.isDirectory()) {
|
|
55
|
+
fs.mkdirSync(destPath, { recursive: true });
|
|
56
|
+
copyTemplate(srcPath, destPath);
|
|
57
|
+
} else {
|
|
58
|
+
fs.copyFileSync(srcPath, destPath);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function main() {
|
|
64
|
+
const args = process.argv.slice(2);
|
|
65
|
+
const projectName = args[0];
|
|
66
|
+
|
|
67
|
+
// Always check for updates first
|
|
68
|
+
await checkForUpdate();
|
|
69
|
+
|
|
70
|
+
if (!projectName) {
|
|
71
|
+
console.log(`Usage: ai-project <project-name>`);
|
|
72
|
+
console.log(` ai-project --version`);
|
|
73
|
+
process.exit(0);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (projectName === "--version" || projectName === "-v") {
|
|
77
|
+
console.log(CURRENT_VERSION);
|
|
78
|
+
process.exit(0);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const dest = path.resolve(process.cwd(), projectName);
|
|
82
|
+
|
|
83
|
+
if (fs.existsSync(dest)) {
|
|
84
|
+
console.error(`Error: directory "${projectName}" already exists.`);
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const templateDir = path.join(__dirname, "../template");
|
|
89
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
90
|
+
copyTemplate(templateDir, dest);
|
|
91
|
+
|
|
92
|
+
// Replace placeholder project name in README
|
|
93
|
+
const readmePath = path.join(dest, "README.md");
|
|
94
|
+
const readme = fs.readFileSync(readmePath, "utf8");
|
|
95
|
+
fs.writeFileSync(readmePath, readme.replace("__PROJECT_NAME__", projectName));
|
|
96
|
+
|
|
97
|
+
console.log(`\nCreated AI-collaborated project: ${projectName}`);
|
|
98
|
+
console.log(`\nFiles created:`);
|
|
99
|
+
console.log(` AI_INSTRUCTIONS.md — AI router (source of truth)`);
|
|
100
|
+
console.log(` CLAUDE.md — Claude Code entry`);
|
|
101
|
+
console.log(` .ai-stage — current stage (PLANNING)`);
|
|
102
|
+
console.log(` CHANGELOG.md`);
|
|
103
|
+
console.log(` README.md`);
|
|
104
|
+
console.log(` docs/planning.md`);
|
|
105
|
+
console.log(` docs/architecture.md`);
|
|
106
|
+
console.log(` docs/testing.md`);
|
|
107
|
+
console.log(` docs/deployment.md`);
|
|
108
|
+
console.log(`\nNext: cd ${projectName} && fill in docs/planning.md`);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ai-project-boilerplate",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "CLI to scaffold AI-collaborated projects with stage-based AI instruction files",
|
|
5
|
+
"bin": {
|
|
6
|
+
"ai-project": "./bin/cli.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin",
|
|
10
|
+
"template"
|
|
11
|
+
],
|
|
12
|
+
"keywords": ["ai", "boilerplate", "claude", "cursor", "copilot", "scaffold"],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/JaydenLiang/ai-project-boilerplate.git"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/JaydenLiang/ai-project-boilerplate/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/JaydenLiang/ai-project-boilerplate#readme",
|
|
22
|
+
"author": "JaydenLiang"
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
PLANNING
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# AI Instructions — AI Router
|
|
2
|
+
|
|
3
|
+
## Current Stage
|
|
4
|
+
Read `.ai-stage` for the current stage value.
|
|
5
|
+
|
|
6
|
+
## Stage → Document Map
|
|
7
|
+
| Stage | Read This File | Purpose |
|
|
8
|
+
|-------|---------------|---------|
|
|
9
|
+
| PLANNING | `docs/planning.md` | Goals, requirements, decisions |
|
|
10
|
+
| CODING | `docs/architecture.md` | Structure, conventions, commands |
|
|
11
|
+
| TESTING | `docs/testing.md` | Test strategy, commands, coverage rules |
|
|
12
|
+
| DEPLOY | `docs/deployment.md` | Env vars, deploy steps, rollback |
|
|
13
|
+
|
|
14
|
+
## Always-Available
|
|
15
|
+
- `CHANGELOG.md` — append completed work after each session
|
|
16
|
+
|
|
17
|
+
## Instructions
|
|
18
|
+
1. Read ONLY the file for the current stage above.
|
|
19
|
+
2. Do not read other stage files unless explicitly asked.
|
|
20
|
+
3. After completing work, append a summary to `CHANGELOG.md`.
|
|
21
|
+
4. When the stage changes, update `.ai-stage` on the current branch.
|
|
22
|
+
|
|
23
|
+
## First-Time Setup (AI tools other than Claude Code)
|
|
24
|
+
If your tool uses a dedicated instructions file (e.g. `.cursorrules` for Cursor,
|
|
25
|
+
`.github/copilot-instructions.md` for Copilot, `.windsurfrules` for Windsurf),
|
|
26
|
+
add the following line to that file so it points here:
|
|
27
|
+
|
|
28
|
+
@AI_INSTRUCTIONS.md
|
|
29
|
+
|
|
30
|
+
or if `@import` is not supported, add:
|
|
31
|
+
|
|
32
|
+
See AI_INSTRUCTIONS.md for all instructions.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@AI_INSTRUCTIONS.md
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# __PROJECT_NAME__
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Architecture
|
|
2
|
+
|
|
3
|
+
## Stack
|
|
4
|
+
<!-- Language, runtime, key dependencies -->
|
|
5
|
+
|
|
6
|
+
## Directory Structure
|
|
7
|
+
```
|
|
8
|
+
/
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Key Conventions
|
|
12
|
+
<!-- Naming, file organization, patterns to follow -->
|
|
13
|
+
-
|
|
14
|
+
|
|
15
|
+
## Commands
|
|
16
|
+
```bash
|
|
17
|
+
# Install
|
|
18
|
+
# Build
|
|
19
|
+
# Run
|
|
20
|
+
# Lint
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Module Responsibilities
|
|
24
|
+
<!-- One line per module/file explaining its role -->
|
|
25
|
+
|
|
26
|
+
## Data Flow
|
|
27
|
+
<!-- How data moves through the system (can be ASCII diagram) -->
|
|
28
|
+
|
|
29
|
+
## Constraints & Off-Limits
|
|
30
|
+
<!-- Things AI must NOT change or touch -->
|
|
31
|
+
-
|
|
32
|
+
|
|
33
|
+
## Next Step
|
|
34
|
+
When implementation is stable and ready for tests, update `.ai-stage` to `TESTING` on this branch.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Deployment
|
|
2
|
+
|
|
3
|
+
## Environment Variables
|
|
4
|
+
| Variable | Required | Description |
|
|
5
|
+
|----------|----------|-------------|
|
|
6
|
+
| | | |
|
|
7
|
+
|
|
8
|
+
## Deploy Steps
|
|
9
|
+
```bash
|
|
10
|
+
# 1.
|
|
11
|
+
# 2.
|
|
12
|
+
# 3.
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Rollback
|
|
16
|
+
```bash
|
|
17
|
+
# How to revert a bad deploy
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Environments
|
|
21
|
+
| Env | URL / Target | Notes |
|
|
22
|
+
|-----|-------------|-------|
|
|
23
|
+
| dev | | |
|
|
24
|
+
| prod| | |
|
|
25
|
+
|
|
26
|
+
## Post-Deploy Checks
|
|
27
|
+
<!-- What to verify after a successful deploy -->
|
|
28
|
+
-
|
|
29
|
+
|
|
30
|
+
## Known Risks
|
|
31
|
+
-
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Planning
|
|
2
|
+
|
|
3
|
+
## Project Goal
|
|
4
|
+
<!-- One sentence: what does this tool do and for whom? -->
|
|
5
|
+
|
|
6
|
+
## Problem Statement
|
|
7
|
+
<!-- What pain does it solve? Why does it need to exist? -->
|
|
8
|
+
|
|
9
|
+
## Non-Goals
|
|
10
|
+
<!-- Explicitly what this project will NOT do -->
|
|
11
|
+
|
|
12
|
+
## Requirements
|
|
13
|
+
### Must Have
|
|
14
|
+
-
|
|
15
|
+
|
|
16
|
+
### Nice to Have
|
|
17
|
+
-
|
|
18
|
+
|
|
19
|
+
## Key Decisions
|
|
20
|
+
<!-- Record decisions HERE so AI doesn't re-litigate them -->
|
|
21
|
+
| Decision | Chosen | Reason |
|
|
22
|
+
|----------|--------|--------|
|
|
23
|
+
| | | |
|
|
24
|
+
|
|
25
|
+
## Open Questions
|
|
26
|
+
<!-- Unresolved items blocking progress -->
|
|
27
|
+
-
|
|
28
|
+
|
|
29
|
+
## Next Step
|
|
30
|
+
<!-- Single next action to move to CODING stage -->
|
|
31
|
+
When requirements are finalized, update `.ai-stage` to `CODING` on this branch.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Testing
|
|
2
|
+
|
|
3
|
+
## Test Commands
|
|
4
|
+
```bash
|
|
5
|
+
# Run all tests
|
|
6
|
+
# Run single test
|
|
7
|
+
# Coverage report
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Coverage Requirements
|
|
11
|
+
<!-- Minimum coverage %, critical paths that must be covered -->
|
|
12
|
+
|
|
13
|
+
## Test Structure
|
|
14
|
+
<!-- Where test files live, naming convention -->
|
|
15
|
+
|
|
16
|
+
## What to Test
|
|
17
|
+
<!-- Key behaviors, edge cases, known fragile areas -->
|
|
18
|
+
-
|
|
19
|
+
|
|
20
|
+
## What NOT to Test
|
|
21
|
+
<!-- Third-party libs, trivial getters, etc. -->
|
|
22
|
+
-
|
|
23
|
+
|
|
24
|
+
## Known Issues / Flaky Tests
|
|
25
|
+
-
|
|
26
|
+
|
|
27
|
+
## Next Step
|
|
28
|
+
When all critical paths are covered and tests pass, update `.ai-stage` to `DEPLOY` on this branch.
|