@itz4blitz/agentful 0.1.0 → 0.1.4

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.
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Template Engine
3
+ *
4
+ * Simple template engine for variable interpolation in agent templates.
5
+ * Supports nested objects, arrays, and conditional rendering.
6
+ */
7
+
8
+ class TemplateEngine {
9
+ /**
10
+ * Render template with data
11
+ */
12
+ static render(template, data) {
13
+ let content = template;
14
+
15
+ // Handle arrays and objects with special formatting FIRST
16
+ content = this.formatComplexTypes(content, data);
17
+
18
+ // Replace simple variables: {{variable}}
19
+ content = this.replaceVariables(content, data);
20
+
21
+ // Add timestamp if needed
22
+ if (content.includes('{{generated_at}}')) {
23
+ content = content.replace(/\{\{generated_at\}\}/g, new Date().toISOString());
24
+ }
25
+
26
+ return content;
27
+ }
28
+
29
+ /**
30
+ * Replace simple variables
31
+ */
32
+ static replaceVariables(content, data) {
33
+ for (const [key, value] of Object.entries(data)) {
34
+ const placeholder = new RegExp(`\\{\\{${key}\\}\\}`, 'g');
35
+ content = content.replace(placeholder, this.formatValue(value));
36
+ }
37
+ return content;
38
+ }
39
+
40
+ /**
41
+ * Format complex types (arrays, objects)
42
+ */
43
+ static formatComplexTypes(content, data) {
44
+ // Handle code_samples first (before generic samples check)
45
+ if (data.codeSamples && Array.isArray(data.codeSamples)) {
46
+ const placeholder = new RegExp('\\{\\{code_samples\\}\\}', 'g');
47
+ const formatted = this.formatSamples(data.codeSamples);
48
+ content = content.replace(placeholder, formatted);
49
+ }
50
+
51
+ // Handle samples array
52
+ if (data.samples && Array.isArray(data.samples)) {
53
+ const placeholder = new RegExp('\\{\\{samples\\}\\}', 'g');
54
+ const formatted = this.formatSamples(data.samples);
55
+ content = content.replace(placeholder, formatted);
56
+ }
57
+ // Handle patterns array - format as bullet points
58
+ if (data.patterns && Array.isArray(data.patterns)) {
59
+ const placeholder = new RegExp('\\{\\{patterns\\}\\}', 'g');
60
+ const formatted = data.patterns
61
+ .map(p => {
62
+ if (typeof p === 'string') return `- ${p}`;
63
+ if (p.keyword && p.context) {
64
+ return `- **${p.keyword}**: Found in codebase`;
65
+ }
66
+ return JSON.stringify(p);
67
+ })
68
+ .join('\n');
69
+ content = content.replace(placeholder, formatted);
70
+ }
71
+
72
+ // Handle conventions array
73
+ if (data.conventions && Array.isArray(data.conventions)) {
74
+ const placeholder = new RegExp('\\{\\{conventions\\}\\}', 'g');
75
+ const formatted = data.conventions
76
+ .filter(c => c && c.trim())
77
+ .map(c => `- ${c}`)
78
+ .join('\n');
79
+ content = content.replace(placeholder, formatted || 'No specific conventions detected');
80
+ }
81
+
82
+ // Handle features array
83
+ if (data.features && Array.isArray(data.features)) {
84
+ const placeholder = new RegExp('\\{\\{features\\}\\}', 'g');
85
+ const formatted = data.features
86
+ .map(f => `- **${f.name}**: ${f.description || 'No description'}`)
87
+ .join('\n');
88
+ content = content.replace(placeholder, formatted || 'No features detected');
89
+ }
90
+
91
+ // Handle endpoints array
92
+ if (data.endpoints && Array.isArray(data.endpoints)) {
93
+ const placeholder = new RegExp('\\{\\{endpoints\\}\\}', 'g');
94
+ const formatted = data.endpoints
95
+ .map(e => `- \`${e.code || e}\``)
96
+ .join('\n');
97
+ content = content.replace(placeholder, formatted || 'No endpoints detected');
98
+ }
99
+
100
+ // Handle models array
101
+ if (data.models && Array.isArray(data.models)) {
102
+ const placeholder = new RegExp('\\{\\{models\\}\\}', 'g');
103
+ const formatted = data.models
104
+ .map(m => `- \`${m.code || m}\``)
105
+ .join('\n');
106
+ content = content.replace(placeholder, formatted || 'No models detected');
107
+ }
108
+
109
+ return content;
110
+ }
111
+
112
+ /**
113
+ * Format code samples for display
114
+ */
115
+ static formatSamples(samples) {
116
+ if (!samples || samples.length === 0) {
117
+ return 'No code samples available yet.';
118
+ }
119
+
120
+ return samples
121
+ .slice(0, 5) // Limit to 5 samples
122
+ .map(sample => {
123
+ if (typeof sample === 'string') return sample;
124
+
125
+ const path = sample.path || 'unknown';
126
+ const content = sample.content || '';
127
+
128
+ return `#### ${path}\n\`\`\`\n${content.substring(0, 800)}${content.length > 800 ? '\n...' : ''}\n\`\`\``;
129
+ })
130
+ .join('\n\n');
131
+ }
132
+
133
+ /**
134
+ * Format value for template
135
+ */
136
+ static formatValue(value) {
137
+ if (value === null || value === undefined) {
138
+ return '';
139
+ }
140
+
141
+ if (Array.isArray(value)) {
142
+ return value.join(', ');
143
+ }
144
+
145
+ if (typeof value === 'object') {
146
+ return JSON.stringify(value, null, 2);
147
+ }
148
+
149
+ return String(value);
150
+ }
151
+ }
152
+
153
+ export default TemplateEngine;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@itz4blitz/agentful",
3
- "version": "0.1.0",
4
- "description": "One-click autonomous product development kit for Claude Code (Alpha - Unstable)",
3
+ "version": "0.1.4",
4
+ "description": "Autonomous product development kit for Claude Code with smart product analysis and natural conversation",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "agentful": "./bin/cli.js"
@@ -10,12 +10,14 @@
10
10
  "init": "node bin/cli.js init",
11
11
  "release": "semantic-release",
12
12
  "release:dry-run": "semantic-release --dry-run",
13
+ "version": "node -e \"const pkg=require('./package.json'); const v=require('./version.json'); v.version=pkg.version; require('fs').writeFileSync('version.json', JSON.stringify(v, null, 2));\"",
13
14
  "docs:dev": "vocs dev",
14
15
  "docs:build": "vocs build",
15
16
  "docs:preview": "vocs preview"
16
17
  },
17
18
  "files": [
18
19
  "bin/",
20
+ "lib/",
19
21
  "template/",
20
22
  ".claude/"
21
23
  ],
@@ -26,17 +28,24 @@
26
28
  "agent",
27
29
  "productivity"
28
30
  ],
29
- "author": "Agentful",
31
+ "author": "agentful",
30
32
  "license": "MIT",
31
33
  "repository": {
32
34
  "type": "git",
33
- "url": "https://github.com/itz4blitz/agentful.git"
35
+ "url": "https://github.com/itz4blitz/agentful"
34
36
  },
35
37
  "homepage": "https://agentful.app",
36
38
  "engines": {
37
- "node": ">=18.0.0"
39
+ "node": ">=22.0.0"
38
40
  },
39
41
  "devDependencies": {
42
+ "@semantic-release/changelog": "^6.0.3",
43
+ "@semantic-release/commit-analyzer": "^13.0.0",
44
+ "@semantic-release/git": "^10.0.1",
45
+ "@semantic-release/github": "^11.0.1",
46
+ "@semantic-release/npm": "^12.0.1",
47
+ "@semantic-release/release-notes-generator": "^14.0.1",
48
+ "semantic-release": "^24.2.0",
40
49
  "vocs": "^1.4.1"
41
50
  }
42
51
  }
@@ -1,14 +1,16 @@
1
- # Agentful Product Development
1
+ # agentful Product Development
2
2
 
3
- This project uses **Agentful** for autonomous product development.
3
+ This project uses **agentful** for autonomous product development.
4
4
 
5
5
  ## Quick Start
6
6
 
7
- 1. Edit `PRODUCT.md` with your product requirements
7
+ 1. Edit your product specification:
8
+ - **Flat structure** (recommended for beginners): Edit `PRODUCT.md` at project root
9
+ - **Hierarchical structure** (for larger projects): Edit files in `.claude/product/`
8
10
  2. Run: `claude`
9
11
  3. Type: `/agentful-start`
10
12
 
11
- That's it. Agentful will begin autonomous development.
13
+ That's it. agentful will begin autonomous development.
12
14
 
13
15
  ## For 24/7 Development
14
16
 
@@ -28,7 +30,7 @@ claude --dangerously-skip-permissions
28
30
 
29
31
  ## Agents
30
32
 
31
- Agentful uses specialized agents that work together:
33
+ agentful uses specialized agents that work together:
32
34
 
33
35
  | Agent | Purpose |
34
36
  |-------|---------|
@@ -51,7 +53,21 @@ Progress is tracked in `.agentful/`:
51
53
 
52
54
  ## Product Specification
53
55
 
54
- Your product is defined in `PRODUCT.md`. This file contains:
56
+ Your product is defined in one of two formats:
57
+
58
+ ### Flat Structure (Recommended for Beginners)
59
+
60
+ - **Location**: `PRODUCT.md` at project root
61
+ - **Format**: Single file with all features
62
+ - **Best for**: Small projects, MVPs, quick prototypes
63
+
64
+ ### Hierarchical Structure (For Larger Projects)
65
+
66
+ - **Location**: `.claude/product/` directory
67
+ - **Format**: Multiple files organized by domain
68
+ - **Best for**: Large projects, teams, complex products
69
+
70
+ The system auto-detects which format you're using. Both formats contain:
55
71
 
56
72
  - Overview and goals
57
73
  - Tech stack decisions
@@ -59,11 +75,31 @@ Your product is defined in `PRODUCT.md`. This file contains:
59
75
  - Acceptance criteria
60
76
  - Architecture notes
61
77
 
78
+ ### Choosing the Right Structure
79
+
80
+ **Start with flat structure if:**
81
+ - You're new to agentful
82
+ - Building an MVP or prototype
83
+ - Project has less than 20 features
84
+ - Working alone or in a small team
85
+
86
+ **Use hierarchical structure if:**
87
+ - Project has 20+ features across multiple domains
88
+ - Multiple team members need to edit specs simultaneously
89
+ - You need better organization for complex projects
90
+ - Your PRODUCT.md file is getting too long (500+ lines)
91
+
92
+ ### Migrating Between Formats
93
+
94
+ You can start with flat and migrate to hierarchical as your project grows. See the migration guide in your product specification file for detailed instructions.
95
+
96
+ The system auto-detects format changes automatically - no configuration needed!
97
+
62
98
  ## How It Works
63
99
 
64
100
  ```mermaid
65
101
  flowchart LR
66
- Start([🚀 Initialize<br/>npx agentful init]) --> Define[📝 Define Product<br/>Edit PRODUCT.md]
102
+ Start([🚀 Initialize<br/>npx @itz4blitz/agentful init]) --> Define[📝 Define Product<br/>Edit PRODUCT.md]
67
103
  Define --> Build[⚡ Start Building<br/>/agentful-start]
68
104
  Build --> Loop{🔄 24/7 Development Loop}
69
105
 
@@ -112,17 +148,17 @@ Code must pass all gates before completion:
112
148
 
113
149
  ## Decision Handling
114
150
 
115
- When Agentful needs your input:
151
+ When agentful needs your input:
116
152
 
117
153
  1. Question is added to `decisions.json`
118
154
  2. Development continues on unblocked features
119
155
  3. Run `/agentful-decide` to answer
120
- 4. Agentful resumes blocked work
156
+ 4. agentful resumes blocked work
121
157
 
122
158
  ## Tech Stack Auto-Detection
123
159
 
124
- Agentful automatically detects your tech stack from:
125
- - `PRODUCT.md` - Explicit tech stack section
160
+ agentful automatically detects your tech stack from:
161
+ - Product specification (`PRODUCT.md` or `.claude/product/index.md`) - Explicit tech stack section
126
162
  - `package.json` - Dependencies and frameworks
127
163
  - Existing code - File patterns and imports
128
164
 
@@ -133,16 +169,16 @@ It then generates specialized agents for your specific stack.
133
169
  ```
134
170
  You: /agentful-start
135
171
 
136
- Agentful: Detected Next.js + TypeScript + Prisma + Tailwind
172
+ agentful: Detected Next.js + TypeScript + Prisma + Tailwind
137
173
  → Generated nextjs-agent, prisma-agent, tailwind-agent
138
174
 
139
- Agentful: Starting work on authentication (priority: CRITICAL)
175
+ agentful: Starting work on authentication (priority: CRITICAL)
140
176
  → @backend implementing JWT service
141
177
  → @backend implementing login API route
142
178
  → @frontend creating login page
143
179
  → @tester writing auth tests
144
180
 
145
- Agentful: Running validation...
181
+ agentful: Running validation...
146
182
  → TypeScript: ✅
147
183
  → Lint: ✅
148
184
  → Tests: ✅
@@ -150,7 +186,7 @@ Agentful: Running validation...
150
186
  → Dead code: ✅
151
187
  → Security: ✅
152
188
 
153
- Agentful: Authentication complete (100%)
189
+ agentful: Authentication complete (100%)
154
190
  Next: User profile feature...
155
191
 
156
192
  [Continues 24/7 until complete]
@@ -166,10 +202,10 @@ All agents and commands can be customized in `.claude/`:
166
202
 
167
203
  ## Getting Help
168
204
 
169
- If Agentful gets stuck:
205
+ If agentful gets stuck:
170
206
 
171
207
  1. Run `/agentful-status` to see current state
172
- 2. Check `PRODUCT.md` for unclear requirements
208
+ 2. Check your product specification (`PRODUCT.md` or `.claude/product/`) for unclear requirements
173
209
  3. Run `/agentful-decide` if decisions are pending
174
210
  4. Run `/agentful-validate` to check for issues
175
211
 
@@ -177,9 +213,12 @@ If Agentful gets stuck:
177
213
 
178
214
  ```
179
215
  .your-project/
180
- ├── PRODUCT.md # Your product spec (you edit this)
216
+ ├── PRODUCT.md # Your product spec - flat structure (you edit this)
181
217
  ├── CLAUDE.md # This file
182
- ├── .claude/ # Agentful configuration
218
+ ├── .claude/ # agentful configuration
219
+ │ ├── product/ # Product spec - hierarchical structure (alternative)
220
+ │ │ ├── index.md # Product overview
221
+ │ │ └── domains/ # Domain-specific specs
183
222
  │ ├── agents/ # Specialized agents
184
223
  │ ├── commands/ # Slash commands
185
224
  │ ├── skills/ # Domain skills
@@ -189,9 +228,11 @@ If Agentful gets stuck:
189
228
  │ ├── completion.json
190
229
  │ ├── decisions.json
191
230
  │ └── architecture.json
192
- └── src/ # Your code (generated by Agentful)
231
+ └── src/ # Your code (generated by agentful)
193
232
  ```
194
233
 
234
+ **Note**: You can use either `PRODUCT.md` (flat) or `.claude/product/` (hierarchical). agentful auto-detects which format you're using.
235
+
195
236
  ---
196
237
 
197
- **Agentful** - Autonomous product development with Claude Code
238
+ **agentful** - Autonomous product development with Claude Code
@@ -1,5 +1,12 @@
1
1
  # Product Specification
2
2
 
3
+ > **Note**: agentful supports **both** flat and hierarchical product structures.
4
+ >
5
+ > - **Flat Structure** (Recommended for beginners): Single file at project root (this file)
6
+ > - **Hierarchical Structure** (For larger projects): `.claude/product/` with separate domain files
7
+ >
8
+ > This template shows the **flat structure** format. To convert to hierarchical structure, see [Migration Guide](#migration-to-hierarchical-structure) below.
9
+
3
10
  ## Overview
4
11
 
5
12
  [Describe what you're building in 2-3 sentences]
@@ -489,8 +496,89 @@ Each subtask should have:
489
496
  - **Priorities** ensure MVP features are built first
490
497
  - **Status tracking** enables autonomous development loops
491
498
 
492
- **Tip**: The more detailed your PRODUCT.md, the better Agentful can understand what to build. Include:
499
+ **Tip**: The more detailed your PRODUCT.md, the better agentful can understand what to build. Include:
493
500
  - Clear acceptance criteria with checkboxes
494
501
  - User stories for context
495
502
  - Technical constraints and notes
496
503
  - Examples when helpful
504
+
505
+ ---
506
+
507
+ ## Migration to Hierarchical Structure
508
+
509
+ When your project grows too large for a single file, you can migrate to the hierarchical structure:
510
+
511
+ ### When to Migrate
512
+
513
+ Consider migrating when:
514
+ - Your PRODUCT.md exceeds 500 lines
515
+ - You have 20+ features across multiple domains
516
+ - Multiple team members need to edit product specs simultaneously
517
+ - You want better organization for complex projects
518
+
519
+ ### How to Migrate
520
+
521
+ 1. **Create the hierarchical structure:**
522
+ ```bash
523
+ mkdir -p .claude/product/domains
524
+ ```
525
+
526
+ 2. **Split your PRODUCT.md into domain files:**
527
+ - Move each domain section to `.claude/product/domains/{domain-name}/index.md`
528
+ - Move each feature to `.claude/product/domains/{domain-name}/features/{feature-name}.md`
529
+ - Create `.claude/product/index.md` with product overview only
530
+
531
+ 3. **System auto-detects the change:**
532
+ - agentful will automatically detect the hierarchical structure
533
+ - No configuration changes needed
534
+
535
+ 4. **Delete or archive the old PRODUCT.md:**
536
+ - You can keep it as a backup
537
+ - Or delete it once migration is complete
538
+
539
+ ### Example Migration
540
+
541
+ **Before (Flat - this file):**
542
+ ```markdown
543
+ # Product Spec
544
+
545
+ ## Domain: Authentication
546
+ ### Feature: Login
547
+ [Details...]
548
+
549
+ ## Domain: User Management
550
+ ### Feature: Profile
551
+ [Details...]
552
+ ```
553
+
554
+ **After (Hierarchical):**
555
+ ```
556
+ .claude/product/
557
+ ├── index.md # Product overview only
558
+ └── domains/
559
+ ├── authentication/
560
+ │ ├── index.md # Domain overview
561
+ │ └── features/
562
+ │ └── login.md # Feature details
563
+ └── user-management/
564
+ ├── index.md
565
+ └── features/
566
+ └── profile.md
567
+ ```
568
+
569
+ ### Detailed Migration Guide
570
+
571
+ For step-by-step instructions, examples, and best practices, see:
572
+ `.claude/product/README.md` in your project (after running `npx @itz4blitz/agentful init`)
573
+
574
+ ### Key Differences
575
+
576
+ | Aspect | Flat Structure | Hierarchical Structure |
577
+ |--------|---------------|----------------------|
578
+ | **File location** | `PRODUCT.md` at root | `.claude/product/` directory |
579
+ | **Organization** | Single file with all features | Multiple files split by domain |
580
+ | **Best for** | Small projects, MVPs, beginners | Large projects, teams, complex products |
581
+ | **Tracking** | Feature-level completion | Subtask → Feature → Domain completion |
582
+ | **Collaboration** | One editor at a time | Multiple editors can work on different domains |
583
+
584
+ Both structures work identically - agentful auto-detects which format you're using!