@mind-fold/open-flow 0.1.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/README.md +176 -0
- package/bin/open-flow.js +3 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +32 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/commands/init.d.ts +8 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +202 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/configurators/claude.d.ts +2 -0
- package/dist/configurators/claude.d.ts.map +1 -0
- package/dist/configurators/claude.js +16 -0
- package/dist/configurators/claude.js.map +1 -0
- package/dist/configurators/cursor.d.ts +2 -0
- package/dist/configurators/cursor.d.ts.map +1 -0
- package/dist/configurators/cursor.js +16 -0
- package/dist/configurators/cursor.js.map +1 -0
- package/dist/configurators/templates.d.ts +9 -0
- package/dist/configurators/templates.d.ts.map +1 -0
- package/dist/configurators/templates.js +97 -0
- package/dist/configurators/templates.js.map +1 -0
- package/dist/configurators/workflow.d.ts +2 -0
- package/dist/configurators/workflow.d.ts.map +1 -0
- package/dist/configurators/workflow.js +739 -0
- package/dist/configurators/workflow.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# open-flow
|
|
2
|
+
|
|
3
|
+
AI-assisted development workflow initializer for Cursor, Claude Code and more.
|
|
4
|
+
|
|
5
|
+
Based on Anthropic's [Effective Harnesses for Long-Running Agents](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents).
|
|
6
|
+
|
|
7
|
+
## Why open-flow?
|
|
8
|
+
|
|
9
|
+
AI coding assistants are powerful but lack continuity across sessions. open-flow adds a lightweight workflow system that gives AI "long-term memory" through structured documentation.
|
|
10
|
+
|
|
11
|
+
Key outcomes:
|
|
12
|
+
- **Multi-developer support**: Each developer (human or AI) has independent progress tracking
|
|
13
|
+
- **Guidelines index system**: `index.md + doc.md` two-layer structure for efficient knowledge access
|
|
14
|
+
- **Short commands**: Pre-defined prompts for common operations
|
|
15
|
+
- **Human-in-the-loop**: AI writes code, human reviews and commits
|
|
16
|
+
|
|
17
|
+
## Getting Started
|
|
18
|
+
|
|
19
|
+
### Prerequisites
|
|
20
|
+
|
|
21
|
+
- Node.js >= 18.0.0
|
|
22
|
+
|
|
23
|
+
### Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install -g open-flow
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Initialize in your project
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
cd my-project
|
|
33
|
+
open-flow init
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
You'll be prompted to select AI tools to configure:
|
|
37
|
+
- Cursor
|
|
38
|
+
- Claude Code
|
|
39
|
+
|
|
40
|
+
### What gets created
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
your-project/
|
|
44
|
+
├── .cursor/commands/ # Cursor short commands
|
|
45
|
+
│ ├── init-agent.md
|
|
46
|
+
│ ├── check-frontend.md
|
|
47
|
+
│ ├── check-backend.md
|
|
48
|
+
│ ├── record-agent-flow.md
|
|
49
|
+
│ └── onboard-developer.md
|
|
50
|
+
├── .claude/commands/ # Claude Code short commands
|
|
51
|
+
├── workflow/
|
|
52
|
+
│ ├── scripts/
|
|
53
|
+
│ │ ├── init-developer.sh
|
|
54
|
+
│ │ └── get-developer.sh
|
|
55
|
+
│ ├── agent-progress/
|
|
56
|
+
│ │ └── index.md
|
|
57
|
+
│ ├── structure/
|
|
58
|
+
│ │ ├── frontend/
|
|
59
|
+
│ │ │ ├── index.md
|
|
60
|
+
│ │ │ └── doc.md
|
|
61
|
+
│ │ └── backend/
|
|
62
|
+
│ │ ├── index.md
|
|
63
|
+
│ │ └── doc.md
|
|
64
|
+
│ ├── feature.json
|
|
65
|
+
│ └── flow.md
|
|
66
|
+
├── init-agent.md
|
|
67
|
+
└── AGENTS.md
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Short Commands
|
|
71
|
+
|
|
72
|
+
| Command | Purpose |
|
|
73
|
+
|---------|---------|
|
|
74
|
+
| `/init-agent` | Initialize AI session, read context and guidelines |
|
|
75
|
+
| `/check-frontend` | Check frontend code against guidelines |
|
|
76
|
+
| `/check-backend` | Check backend code against guidelines |
|
|
77
|
+
| `/record-agent-flow` | Record work progress (after human commits) |
|
|
78
|
+
| `/onboard-developer` | Guide new developer through setup |
|
|
79
|
+
|
|
80
|
+
## Workflow
|
|
81
|
+
|
|
82
|
+
### 1. Initialize Developer Identity
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
./workflow/scripts/init-developer.sh <your-name>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 2. Start AI Session
|
|
89
|
+
|
|
90
|
+
Use `/init-agent` command in your AI tool.
|
|
91
|
+
|
|
92
|
+
### 3. Development
|
|
93
|
+
|
|
94
|
+
1. AI reads guidelines from `workflow/structure/`
|
|
95
|
+
2. AI writes code following the guidelines
|
|
96
|
+
3. Human reviews and tests
|
|
97
|
+
4. Human commits the code
|
|
98
|
+
5. Use `/record-agent-flow` to record progress
|
|
99
|
+
|
|
100
|
+
### 4. Customize Guidelines
|
|
101
|
+
|
|
102
|
+
Fill in your project-specific guidelines in:
|
|
103
|
+
- `workflow/structure/frontend/doc.md`
|
|
104
|
+
- `workflow/structure/backend/doc.md`
|
|
105
|
+
|
|
106
|
+
Update the `index.md` files with correct line numbers for quick navigation.
|
|
107
|
+
|
|
108
|
+
## Key Concepts
|
|
109
|
+
|
|
110
|
+
### index.md + doc.md Structure
|
|
111
|
+
|
|
112
|
+
Instead of reading entire guideline documents (which can be 1000+ lines), AI:
|
|
113
|
+
1. Reads the lightweight `index.md` (navigation table)
|
|
114
|
+
2. Finds relevant section and line numbers
|
|
115
|
+
3. Reads only the needed sections from `doc.md`
|
|
116
|
+
|
|
117
|
+
This saves tokens and improves focus.
|
|
118
|
+
|
|
119
|
+
### Multi-Developer Progress Tracking
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
workflow/agent-progress/
|
|
123
|
+
├── index.md # Main index
|
|
124
|
+
└── {developer}/ # Per-developer directory
|
|
125
|
+
├── index.md # Personal index
|
|
126
|
+
└── progress-N.md # Progress files (max 2000 lines each)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Each developer has independent progress files that don't conflict during collaboration.
|
|
130
|
+
|
|
131
|
+
### Human-in-the-Loop
|
|
132
|
+
|
|
133
|
+
AI should NOT execute `git commit`. The workflow is:
|
|
134
|
+
1. AI writes code
|
|
135
|
+
2. Human tests locally
|
|
136
|
+
3. Human reviews code
|
|
137
|
+
4. Human commits
|
|
138
|
+
5. AI records progress with commit hash
|
|
139
|
+
|
|
140
|
+
## Commands
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
open-flow init # Initialize in current project
|
|
144
|
+
open-flow update # Update configuration (coming soon)
|
|
145
|
+
open-flow --version # Show version
|
|
146
|
+
open-flow --help # Show help
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Comparison with OpenSpec
|
|
150
|
+
|
|
151
|
+
| Aspect | OpenSpec | open-flow |
|
|
152
|
+
|--------|----------|-----------|
|
|
153
|
+
| Focus | Spec-driven development | Memory-driven workflow |
|
|
154
|
+
| Main feature | Change proposals & specs | Progress tracking & guidelines |
|
|
155
|
+
| Collaboration | Single change flow | Multi-developer directories |
|
|
156
|
+
| Guidelines | N/A | index.md + doc.md system |
|
|
157
|
+
|
|
158
|
+
Both can be used together - OpenSpec for specs, open-flow for workflow.
|
|
159
|
+
|
|
160
|
+
## Contributing
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Install dependencies
|
|
164
|
+
npm install
|
|
165
|
+
|
|
166
|
+
# Build
|
|
167
|
+
npm run build
|
|
168
|
+
|
|
169
|
+
# Development
|
|
170
|
+
npm run dev
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## License
|
|
174
|
+
|
|
175
|
+
MIT
|
|
176
|
+
|
package/bin/open-flow.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO,UAAU,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { init } from "../commands/init.js";
|
|
4
|
+
export const VERSION = "0.1.0";
|
|
5
|
+
const program = new Command();
|
|
6
|
+
program
|
|
7
|
+
.name("open-flow")
|
|
8
|
+
.description("AI-assisted development workflow initializer for Cursor, Claude Code and more")
|
|
9
|
+
.version(VERSION);
|
|
10
|
+
program
|
|
11
|
+
.command("init")
|
|
12
|
+
.description("Initialize open-flow in the current project")
|
|
13
|
+
.option("--cursor", "Include Cursor commands")
|
|
14
|
+
.option("--claude", "Include Claude Code commands")
|
|
15
|
+
.option("-y, --yes", "Skip prompts and use defaults")
|
|
16
|
+
.action(async (options) => {
|
|
17
|
+
try {
|
|
18
|
+
await init(options);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.error(chalk.red("Error:"), error instanceof Error ? error.message : error);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
program
|
|
26
|
+
.command("update")
|
|
27
|
+
.description("Update open-flow configuration and commands")
|
|
28
|
+
.action(async () => {
|
|
29
|
+
console.log(chalk.yellow("Coming soon: update command"));
|
|
30
|
+
});
|
|
31
|
+
program.parse();
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AAAA,OA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|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAQA,UAAU,WAAW;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;CACd;AAOD,wBAAsB,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAoG9D"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import inquirer from "inquirer";
|
|
5
|
+
import { configureClaude } from "../configurators/claude.js";
|
|
6
|
+
import { configureCursor } from "../configurators/cursor.js";
|
|
7
|
+
import { createWorkflowStructure } from "../configurators/workflow.js";
|
|
8
|
+
export async function init(options) {
|
|
9
|
+
const cwd = process.cwd();
|
|
10
|
+
console.log(chalk.cyan("\n🚀 open-flow - AI-assisted development workflow initializer\n"));
|
|
11
|
+
// Check if already initialized
|
|
12
|
+
const workflowDir = path.join(cwd, "workflow");
|
|
13
|
+
if (fs.existsSync(workflowDir)) {
|
|
14
|
+
const { overwrite } = await inquirer.prompt([
|
|
15
|
+
{
|
|
16
|
+
type: "confirm",
|
|
17
|
+
name: "overwrite",
|
|
18
|
+
message: chalk.yellow("workflow/ directory already exists. Overwrite?"),
|
|
19
|
+
default: false,
|
|
20
|
+
},
|
|
21
|
+
]);
|
|
22
|
+
if (!overwrite) {
|
|
23
|
+
console.log(chalk.gray("Initialization cancelled."));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
let tools;
|
|
28
|
+
if (options.yes) {
|
|
29
|
+
// Default: both Cursor and Claude
|
|
30
|
+
tools = ["cursor", "claude"];
|
|
31
|
+
}
|
|
32
|
+
else if (options.cursor || options.claude) {
|
|
33
|
+
// Use flags
|
|
34
|
+
tools = [];
|
|
35
|
+
if (options.cursor)
|
|
36
|
+
tools.push("cursor");
|
|
37
|
+
if (options.claude)
|
|
38
|
+
tools.push("claude");
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
// Interactive mode
|
|
42
|
+
const answers = await inquirer.prompt([
|
|
43
|
+
{
|
|
44
|
+
type: "checkbox",
|
|
45
|
+
name: "tools",
|
|
46
|
+
message: "Select AI tools to configure:",
|
|
47
|
+
choices: [
|
|
48
|
+
{ name: "Cursor", value: "cursor", checked: true },
|
|
49
|
+
{ name: "Claude Code", value: "claude", checked: true },
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
]);
|
|
53
|
+
tools = answers.tools;
|
|
54
|
+
}
|
|
55
|
+
if (tools.length === 0) {
|
|
56
|
+
console.log(chalk.yellow("No tools selected. At least one tool is required."));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
console.log(chalk.gray(`\nConfiguring: ${tools.join(", ")}\n`));
|
|
60
|
+
// Create workflow structure
|
|
61
|
+
console.log(chalk.blue("📁 Creating workflow structure..."));
|
|
62
|
+
await createWorkflowStructure(cwd);
|
|
63
|
+
// Configure selected tools
|
|
64
|
+
if (tools.includes("cursor")) {
|
|
65
|
+
console.log(chalk.blue("📝 Configuring Cursor commands..."));
|
|
66
|
+
await configureCursor(cwd);
|
|
67
|
+
}
|
|
68
|
+
if (tools.includes("claude")) {
|
|
69
|
+
console.log(chalk.blue("📝 Configuring Claude Code commands..."));
|
|
70
|
+
await configureClaude(cwd);
|
|
71
|
+
}
|
|
72
|
+
// Create root files
|
|
73
|
+
await createRootFiles(cwd);
|
|
74
|
+
console.log(chalk.green("\n✅ open-flow initialized successfully!\n"));
|
|
75
|
+
// Print next steps
|
|
76
|
+
console.log(chalk.cyan("Next steps:"));
|
|
77
|
+
console.log(chalk.gray(" 1. Run ") +
|
|
78
|
+
chalk.white("./workflow/scripts/init-developer.sh <your-name>") +
|
|
79
|
+
chalk.gray(" to set up your developer identity"));
|
|
80
|
+
console.log(chalk.gray(" 2. Fill in ") +
|
|
81
|
+
chalk.white("workflow/structure/") +
|
|
82
|
+
chalk.gray(" with your project-specific guidelines"));
|
|
83
|
+
console.log(chalk.gray(" 3. Use ") +
|
|
84
|
+
chalk.white("/init-agent") +
|
|
85
|
+
chalk.gray(" command in your AI tool to start a session\n"));
|
|
86
|
+
}
|
|
87
|
+
async function createRootFiles(cwd) {
|
|
88
|
+
// Create init-agent.md
|
|
89
|
+
const initAgentContent = `# AI Agent Initialization Guide
|
|
90
|
+
|
|
91
|
+
> **Purpose**: Quick onboarding document for new AI Agent sessions. Read this first to understand the project and workflow.
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Quick Start (Do This First)
|
|
96
|
+
|
|
97
|
+
### Step 0: Initialize Developer Identity (First Time Only)
|
|
98
|
+
|
|
99
|
+
> ⚠️ **Multi-developer support**: Each developer/Agent needs to initialize their identity first
|
|
100
|
+
|
|
101
|
+
\`\`\`bash
|
|
102
|
+
# Check if already initialized
|
|
103
|
+
./workflow/scripts/get-developer.sh
|
|
104
|
+
|
|
105
|
+
# If not initialized, run:
|
|
106
|
+
./workflow/scripts/init-developer.sh <your-name>
|
|
107
|
+
# Example: ./workflow/scripts/init-developer.sh cursor-agent
|
|
108
|
+
\`\`\`
|
|
109
|
+
|
|
110
|
+
This creates:
|
|
111
|
+
- \`workflow/.developer\` - Your identity file (gitignored)
|
|
112
|
+
- \`workflow/agent-progress/<your-name>/\` - Your personal progress directory
|
|
113
|
+
|
|
114
|
+
### Step 1: Understand Current Context
|
|
115
|
+
|
|
116
|
+
\`\`\`bash
|
|
117
|
+
# 0. Check your identity
|
|
118
|
+
./workflow/scripts/get-developer.sh
|
|
119
|
+
|
|
120
|
+
# 1. Check recent work progress (your own progress)
|
|
121
|
+
DEVELOPER=$(./workflow/scripts/get-developer.sh)
|
|
122
|
+
cat workflow/agent-progress/$DEVELOPER/index.md 2>/dev/null || cat workflow/agent-progress/index.md
|
|
123
|
+
|
|
124
|
+
# 2. Check feature status
|
|
125
|
+
cat workflow/feature.json
|
|
126
|
+
|
|
127
|
+
# 3. Check git history
|
|
128
|
+
git status
|
|
129
|
+
git log --oneline -20
|
|
130
|
+
\`\`\`
|
|
131
|
+
|
|
132
|
+
### Step 2: Read Project Guidelines
|
|
133
|
+
|
|
134
|
+
Based on your task, read the corresponding guidelines:
|
|
135
|
+
|
|
136
|
+
\`\`\`bash
|
|
137
|
+
# Frontend guidelines
|
|
138
|
+
cat workflow/structure/frontend/index.md
|
|
139
|
+
|
|
140
|
+
# Backend guidelines
|
|
141
|
+
cat workflow/structure/backend/index.md
|
|
142
|
+
\`\`\`
|
|
143
|
+
|
|
144
|
+
### Step 3: Read Workflow Guide
|
|
145
|
+
|
|
146
|
+
\`\`\`bash
|
|
147
|
+
cat workflow/flow.md
|
|
148
|
+
\`\`\`
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Development Workflow
|
|
153
|
+
|
|
154
|
+
1. **Read Before Write** - Understand context before starting
|
|
155
|
+
2. **Follow Standards** - Read \`workflow/structure/\` guidelines before coding
|
|
156
|
+
3. **Incremental Development** - Complete one feature at a time
|
|
157
|
+
4. **Record Promptly** - Update tracking files after completion
|
|
158
|
+
5. **Document Limits** - Max 2000 lines per agent-progress document
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Key Rules
|
|
163
|
+
|
|
164
|
+
### DO
|
|
165
|
+
- Read guidelines before coding
|
|
166
|
+
- Update agent-progress after each session
|
|
167
|
+
- Run lint and type-check before finishing
|
|
168
|
+
|
|
169
|
+
### DON'T
|
|
170
|
+
- Skip reading guidelines (CRITICAL VIOLATION)
|
|
171
|
+
- Let agent-progress exceed 2000 lines
|
|
172
|
+
- Commit code with lint/type-check errors
|
|
173
|
+
- Execute \`git commit\` - AI should not commit, human reviews and commits
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
**Ready to start? Follow the Quick Start section above!**
|
|
178
|
+
`;
|
|
179
|
+
fs.writeFileSync(path.join(cwd, "init-agent.md"), initAgentContent);
|
|
180
|
+
// Create AGENTS.md
|
|
181
|
+
const agentsContent = `<!-- OPEN-FLOW:START -->
|
|
182
|
+
# Open-Flow Instructions
|
|
183
|
+
|
|
184
|
+
These instructions are for AI assistants working in this project.
|
|
185
|
+
|
|
186
|
+
Always open \`@/init-agent.md\` when starting a new session to:
|
|
187
|
+
- Initialize your developer identity
|
|
188
|
+
- Understand current project context
|
|
189
|
+
- Read relevant guidelines
|
|
190
|
+
|
|
191
|
+
Use \`@/workflow/\` to learn:
|
|
192
|
+
- Development workflow (\`flow.md\`)
|
|
193
|
+
- Project structure guidelines (\`structure/\`)
|
|
194
|
+
- Progress tracking (\`agent-progress/\`)
|
|
195
|
+
|
|
196
|
+
Keep this managed block so 'open-flow update' can refresh the instructions.
|
|
197
|
+
|
|
198
|
+
<!-- OPEN-FLOW:END -->
|
|
199
|
+
`;
|
|
200
|
+
fs.writeFileSync(path.join(cwd, "AGENTS.md"), agentsContent);
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAavE,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAAoB;IAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAE1B,OAAO,CAAC,GAAG,CAC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chE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { getCommandTemplates } from './templates.js';
|
|
4
|
+
export async function configureClaude(cwd) {
|
|
5
|
+
const commandsDir = path.join(cwd, '.claude', 'commands');
|
|
6
|
+
// Create directory
|
|
7
|
+
fs.mkdirSync(commandsDir, { recursive: true });
|
|
8
|
+
// Get command templates
|
|
9
|
+
const templates = getCommandTemplates();
|
|
10
|
+
// Write each command file
|
|
11
|
+
for (const [name, content] of Object.entries(templates)) {
|
|
12
|
+
const filePath = path.join(commandsDir, `${name}.md`);
|
|
13
|
+
fs.writeFileSync(filePath, content);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=claude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/configurators/claude.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,GAAW;IAC/C,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IAE1D,mBAAmB;IACnB,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE/C,wBAAwB;IACxB,MAAM,SAAS,GAAG,mBAAmB,EAAE,CAAC;IAExC,0BAA0B;IAC1B,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACxD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,IAAI,KAAK,CAAC,CAAC;QACtD,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../src/configurators/cursor.ts"],"names":[],"mappings":"AAIA,wBAAsB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAchE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { getCommandTemplates } from './templates.js';
|
|
4
|
+
export async function configureCursor(cwd) {
|
|
5
|
+
const commandsDir = path.join(cwd, '.cursor', 'commands');
|
|
6
|
+
// Create directory
|
|
7
|
+
fs.mkdirSync(commandsDir, { recursive: true });
|
|
8
|
+
// Get command templates
|
|
9
|
+
const templates = getCommandTemplates();
|
|
10
|
+
// Write each command file
|
|
11
|
+
for (const [name, content] of Object.entries(templates)) {
|
|
12
|
+
const filePath = path.join(commandsDir, `${name}.md`);
|
|
13
|
+
fs.writeFileSync(filePath, content);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=cursor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../src/configurators/cursor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,GAAW;IAC/C,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;IAE1D,mBAAmB;IACnB,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAE/C,wBAAwB;IACxB,MAAM,SAAS,GAAG,mBAAmB,EAAE,CAAC;IAExC,0BAA0B;IAC1B,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACxD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,IAAI,KAAK,CAAC,CAAC;QACtD,EAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Short command templates for AI assistants
|
|
3
|
+
* These are the core commands that enable AI-assisted development workflow
|
|
4
|
+
*/
|
|
5
|
+
export interface CommandTemplates {
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function getCommandTemplates(): CommandTemplates;
|
|
9
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/configurators/templates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED,wBAAgB,mBAAmB,IAAI,gBAAgB,CAQtD"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Short command templates for AI assistants
|
|
3
|
+
* These are the core commands that enable AI-assisted development workflow
|
|
4
|
+
*/
|
|
5
|
+
export function getCommandTemplates() {
|
|
6
|
+
return {
|
|
7
|
+
'init-agent': getInitAgentTemplate(),
|
|
8
|
+
'check-frontend': getCheckFrontendTemplate(),
|
|
9
|
+
'check-backend': getCheckBackendTemplate(),
|
|
10
|
+
'record-agent-flow': getRecordAgentFlowTemplate(),
|
|
11
|
+
'onboard-developer': getOnboardDeveloperTemplate(),
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function getInitAgentTemplate() {
|
|
15
|
+
return `Read the project root's init-agent.md file and follow the instructions to initialize the AI session.
|
|
16
|
+
|
|
17
|
+
Execute these steps:
|
|
18
|
+
1. Check developer identity: \`./workflow/scripts/get-developer.sh\`
|
|
19
|
+
2. If not initialized, guide the user to run: \`./workflow/scripts/init-developer.sh <name>\`
|
|
20
|
+
3. Read your progress: \`workflow/agent-progress/{developer}/index.md\`
|
|
21
|
+
4. Read feature status: \`workflow/feature.json\`
|
|
22
|
+
5. Read relevant structure guidelines based on the task
|
|
23
|
+
6. Report ready status and ask for the task
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
function getCheckFrontendTemplate() {
|
|
27
|
+
return `Check if the code you just wrote follows the frontend development guidelines.
|
|
28
|
+
|
|
29
|
+
Execute these steps:
|
|
30
|
+
1. Run \`git status\` to see modified files
|
|
31
|
+
2. Read \`workflow/structure/frontend/index.md\` to find relevant guidelines
|
|
32
|
+
3. Read the specific sections in \`workflow/structure/frontend/doc.md\` based on your changes
|
|
33
|
+
4. Review your code against the guidelines
|
|
34
|
+
5. Report any violations and fix them if found
|
|
35
|
+
`;
|
|
36
|
+
}
|
|
37
|
+
function getCheckBackendTemplate() {
|
|
38
|
+
return `Check if the code you just wrote follows the backend development guidelines.
|
|
39
|
+
|
|
40
|
+
Execute these steps:
|
|
41
|
+
1. Run \`git status\` to see modified files
|
|
42
|
+
2. Read \`workflow/structure/backend/index.md\` to find relevant guidelines
|
|
43
|
+
3. Read the specific sections in \`workflow/structure/backend/doc.md\` based on your changes
|
|
44
|
+
4. Review your code against the guidelines
|
|
45
|
+
5. Report any violations and fix them if found
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
function getRecordAgentFlowTemplate() {
|
|
49
|
+
return `⚠️ **Prerequisite**: This command should only be used AFTER the human has tested and committed the code.
|
|
50
|
+
|
|
51
|
+
**AI must NOT execute git commit** - only read history (\`git log\`, \`git status\`, \`git diff\`).
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
Record the committed code changes to workflow/agent-progress:
|
|
56
|
+
|
|
57
|
+
1. Get developer identity: \`./workflow/scripts/get-developer.sh\`
|
|
58
|
+
2. Get latest commits: \`git log --oneline -5\`
|
|
59
|
+
3. Update progress file: \`workflow/agent-progress/{developer}/progress-N.md\`
|
|
60
|
+
4. Update personal index: \`workflow/agent-progress/{developer}/index.md\`
|
|
61
|
+
|
|
62
|
+
Record content should include:
|
|
63
|
+
- Summary: One-line description
|
|
64
|
+
- Main Changes: Files and descriptions
|
|
65
|
+
- Git Commits: Hash and message (REQUIRED)
|
|
66
|
+
- Testing: Lint/type-check status
|
|
67
|
+
- Next Steps: What to do next
|
|
68
|
+
`;
|
|
69
|
+
}
|
|
70
|
+
function getOnboardDeveloperTemplate() {
|
|
71
|
+
return `A new developer needs onboarding.
|
|
72
|
+
|
|
73
|
+
Execute these steps in order:
|
|
74
|
+
|
|
75
|
+
1. **Explain the workflow system** - Describe how open-flow works:
|
|
76
|
+
- \`workflow/\` directory structure
|
|
77
|
+
- Short commands available (/init-agent, /check-frontend, /check-backend, /record-agent-flow)
|
|
78
|
+
- Guidelines in \`workflow/structure/\`
|
|
79
|
+
- Progress tracking in \`workflow/agent-progress/\`
|
|
80
|
+
|
|
81
|
+
2. **Initialize their identity**:
|
|
82
|
+
\`\`\`bash
|
|
83
|
+
./workflow/scripts/init-developer.sh <developer-name>
|
|
84
|
+
\`\`\`
|
|
85
|
+
|
|
86
|
+
3. **Guide them through first task**:
|
|
87
|
+
- Read \`workflow/feature.json\` to find a task
|
|
88
|
+
- Read relevant guidelines in \`workflow/structure/\`
|
|
89
|
+
- Start coding
|
|
90
|
+
|
|
91
|
+
Key points to emphasize:
|
|
92
|
+
- AI should NOT execute \`git commit\` - human is responsible for testing and committing
|
|
93
|
+
- Each developer has their own progress directory
|
|
94
|
+
- Read guidelines before coding (mandatory)
|
|
95
|
+
`;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/configurators/templates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,YAAY,EAAE,oBAAoB,EAAE;QACpC,gBAAgB,EAAE,wBAAwB,EAAE;QAC5C,eAAe,EAAE,uBAAuB,EAAE;QAC1C,mBAAmB,EAAE,0BAA0B,EAAE;QACjD,mBAAmB,EAAE,2BAA2B,EAAE;KACnD,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB;IAC3B,OAAO;;;;;;;;;CASR,CAAC;AACF,CAAC;AAED,SAAS,wBAAwB;IAC/B,OAAO;;;;;;;;CAQR,CAAC;AACF,CAAC;AAED,SAAS,uBAAuB;IAC9B,OAAO;;;;;;;;CAQR,CAAC;AACF,CAAC;AAED,SAAS,0BAA0B;IACjC,OAAO;;;;;;;;;;;;;;;;;;;CAmBR,CAAC;AACF,CAAC;AAED,SAAS,2BAA2B;IAClC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;CAwBR,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../src/configurators/workflow.ts"],"names":[],"mappings":"AAGA,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkCxE"}
|