oneie 3.6.27 → 3.6.30
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/.claude/agents/agent-builder.md +88 -0
- package/.claude/agents/agent-clone.md +2 -0
- package/.claude/agents/agent-frontend.md +87 -0
- package/.claude/agents/agent-writer.md +722 -0
- package/.claude/commands/create.md +26 -1
- package/.claude/commands/one.md +70 -8
- package/.claude/commands/push.md +42 -24
- package/.claude/commands/server.md +97 -48
- package/.claude/commands/start.md +182 -0
- package/.claude/hooks/.last-news-context +1 -0
- package/.claude/hooks/README-news-generation.md +364 -0
- package/.claude/hooks/push.sh +64 -12
- package/.claude/hooks/write-news.sh +194 -0
- package/CLAUDE.md +150 -1057
- package/one/knowledge/ontology-cheatsheet.md +78 -70
- package/one/knowledge/ontology-developer-guide.md +94 -87
- package/one/knowledge/ontology-index.md +51 -26
- package/one/knowledge/ontology-quickstart.md +58 -50
- package/one/knowledge/ontology-tutorial.md +27 -24
- package/one/knowledge/ontology-video-script.md +90 -59
- package/one/things/plans/multi-ontology-architecture.md +8 -8
- package/one/things/plans/ontology-compliance-audit.md +36 -9
- package/one/things/plans/video-backend.md +638 -0
- package/one/things/plans/video-frontend.md +432 -0
- package/one/things/plans/video-old-archived.md +656 -0
- package/package.json +1 -1
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
# Automated News Generation from Git Commits
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Every meaningful commit automatically triggers news article generation using the `agent-writer` agent.
|
|
6
|
+
|
|
7
|
+
**Flow:**
|
|
8
|
+
```
|
|
9
|
+
git commit → post-commit hook → write-news.sh → agent-writer → news article
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Files Created
|
|
13
|
+
|
|
14
|
+
### Agent
|
|
15
|
+
- `.claude/agents/agent-writer.md` - Content strategist with voice inspired by Alex Hormozi, Wired, Ars Technica, Fast Company, and Theo
|
|
16
|
+
|
|
17
|
+
### Hook
|
|
18
|
+
- `.claude/hooks/write-news.sh` - Postcommit hook that prepares context for news generation
|
|
19
|
+
- `.git/hooks/post-commit` - Updated to call write-news.sh
|
|
20
|
+
|
|
21
|
+
### Output
|
|
22
|
+
- `web/src/content/news/*.md` - Generated news articles (no dates in filenames!)
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
### Automatic (After Each Commit)
|
|
27
|
+
|
|
28
|
+
The hook runs automatically after every commit:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
git commit -m "feat: Add video upload support"
|
|
32
|
+
# Hook fires, prepares context for news generation
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Skip News Generation
|
|
36
|
+
|
|
37
|
+
Add `[skip-news]` or `[no-news]` to skip:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
git commit -m "fix: typo [skip-news]"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Manual Generation
|
|
44
|
+
|
|
45
|
+
Ask Claude Code to use agent-writer:
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
Use agent-writer to create a news article from the latest commit.
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Claude will:
|
|
52
|
+
1. Read commit info from the prepared context
|
|
53
|
+
2. Generate engaging article with proper voice
|
|
54
|
+
3. Save to `web/src/content/news/[descriptive-slug].md`
|
|
55
|
+
|
|
56
|
+
## Voice Guidelines
|
|
57
|
+
|
|
58
|
+
### Style Pillars
|
|
59
|
+
|
|
60
|
+
1. **Authority** - We know our shit. Zero fluff.
|
|
61
|
+
2. **Humor** - Code is serious. Writing about it isn't.
|
|
62
|
+
3. **Sarcasm** - When appropriate (earned, not default)
|
|
63
|
+
4. **Warmth** - Rooting for the reader
|
|
64
|
+
5. **Education** - Every piece teaches something
|
|
65
|
+
|
|
66
|
+
### Influences
|
|
67
|
+
|
|
68
|
+
- **Alex Hormozi** - Direct, value-focused, no filler
|
|
69
|
+
- **Wired** - Technical depth with narrative
|
|
70
|
+
- **Ars Technica** - Respects reader intelligence
|
|
71
|
+
- **Fast Company** - Business implications clear
|
|
72
|
+
- **Theo (YouTube)** - Modern dev voice, opinionated but fair
|
|
73
|
+
|
|
74
|
+
### Do This
|
|
75
|
+
|
|
76
|
+
✅ Benefits before features
|
|
77
|
+
✅ Specificity (87% faster, not "faster")
|
|
78
|
+
✅ Code examples over walls of text
|
|
79
|
+
✅ Self-aware humor
|
|
80
|
+
|
|
81
|
+
### Avoid This
|
|
82
|
+
|
|
83
|
+
❌ Jargon without explanation
|
|
84
|
+
❌ Features without benefits
|
|
85
|
+
❌ Punching down at readers
|
|
86
|
+
❌ Humor that obscures the message
|
|
87
|
+
|
|
88
|
+
## File Naming
|
|
89
|
+
|
|
90
|
+
**CRITICAL:** Use descriptive slugs, NOT dates.
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
✅ video-upload-cloudflare-stream.md
|
|
94
|
+
✅ api-separation-rest-graphql.md
|
|
95
|
+
✅ lighthouse-perfect-scores.md
|
|
96
|
+
|
|
97
|
+
❌ 2025-11-08-video-upload.md
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**Why?**
|
|
101
|
+
- Better URLs: `one.ie/news/video-upload` vs `one.ie/news/2025-11-08-video`
|
|
102
|
+
- SEO-friendly keywords in URL
|
|
103
|
+
- Timeless content (no stale dates)
|
|
104
|
+
- Date goes in frontmatter, not filename
|
|
105
|
+
|
|
106
|
+
## Commit Types That Trigger News
|
|
107
|
+
|
|
108
|
+
| Type | Generates News? | Category |
|
|
109
|
+
|------|----------------|----------|
|
|
110
|
+
| `feat` | ✅ Yes | feature |
|
|
111
|
+
| `fix` | ✅ Yes | infrastructure |
|
|
112
|
+
| `perf` | ✅ Yes | article |
|
|
113
|
+
| `refactor` | ✅ Yes | infrastructure |
|
|
114
|
+
| `docs` | ❌ No | - |
|
|
115
|
+
| `chore` | ❌ No | - |
|
|
116
|
+
| `style` | ❌ No | - |
|
|
117
|
+
| `test` | ❌ No | - |
|
|
118
|
+
|
|
119
|
+
## Article Structure
|
|
120
|
+
|
|
121
|
+
```markdown
|
|
122
|
+
---
|
|
123
|
+
title: "[Benefit-Focused Headline]"
|
|
124
|
+
date: 2025-11-08
|
|
125
|
+
description: "One-sentence value proposition"
|
|
126
|
+
author: "ONE Platform Team"
|
|
127
|
+
type: "feature_update"
|
|
128
|
+
tags: ["tag1", "tag2", "tag3"]
|
|
129
|
+
category: "feature"
|
|
130
|
+
repo: "web"
|
|
131
|
+
draft: false
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## What Changed
|
|
135
|
+
|
|
136
|
+
[Clear explanation of the update]
|
|
137
|
+
|
|
138
|
+
## Why This Matters
|
|
139
|
+
|
|
140
|
+
[Connect to user needs/pain points]
|
|
141
|
+
|
|
142
|
+
## How It Works
|
|
143
|
+
|
|
144
|
+
[Technical details with examples]
|
|
145
|
+
|
|
146
|
+
## What You Can Do Now
|
|
147
|
+
|
|
148
|
+
[Clear next steps for readers]
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Customization
|
|
152
|
+
|
|
153
|
+
### Change the Voice
|
|
154
|
+
|
|
155
|
+
Edit `.claude/agents/agent-writer.md`:
|
|
156
|
+
|
|
157
|
+
```markdown
|
|
158
|
+
## Your Voice
|
|
159
|
+
|
|
160
|
+
[Add your brand personality]
|
|
161
|
+
|
|
162
|
+
## Your Influences
|
|
163
|
+
|
|
164
|
+
[List your style inspirations]
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Change the Hook Behavior
|
|
168
|
+
|
|
169
|
+
Edit `.claude/hooks/write-news.sh`:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# Skip different commit types
|
|
173
|
+
if [[ "$COMMIT_TYPE" == "your-type" ]]; then
|
|
174
|
+
exit 0
|
|
175
|
+
fi
|
|
176
|
+
|
|
177
|
+
# Change category mapping
|
|
178
|
+
case "$COMMIT_TYPE" in
|
|
179
|
+
custom)
|
|
180
|
+
CATEGORY="your-category"
|
|
181
|
+
;;
|
|
182
|
+
esac
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Examples
|
|
186
|
+
|
|
187
|
+
### Example 1: Feature Launch
|
|
188
|
+
|
|
189
|
+
**Commit:**
|
|
190
|
+
```bash
|
|
191
|
+
git commit -m "feat: Add GraphQL API support with auto-generated types"
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Generated Article:**
|
|
195
|
+
- Title: "Build Integrations 10x Faster With GraphQL API"
|
|
196
|
+
- Focuses on user benefits (faster development)
|
|
197
|
+
- Shows code examples
|
|
198
|
+
- Explains technical implementation
|
|
199
|
+
- Clear next steps
|
|
200
|
+
|
|
201
|
+
### Example 2: Performance Win
|
|
202
|
+
|
|
203
|
+
**Commit:**
|
|
204
|
+
```bash
|
|
205
|
+
git commit -m "perf: Reduce build time from 23s to 3s (87% faster)"
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
**Generated Article:**
|
|
209
|
+
- Title: "Subsecond Builds: How We Cut Build Time by 87%"
|
|
210
|
+
- Opens with developer pain (waiting for builds)
|
|
211
|
+
- Explains optimization techniques
|
|
212
|
+
- Shows before/after metrics
|
|
213
|
+
- Includes lessons learned
|
|
214
|
+
|
|
215
|
+
### Example 3: Bug Fix
|
|
216
|
+
|
|
217
|
+
**Commit:**
|
|
218
|
+
```bash
|
|
219
|
+
git commit -m "fix: Resolve mobile authentication timeout issue"
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
**Generated Article:**
|
|
223
|
+
- Title: "Mobile Login Now Works Instantly (Sorry About That)"
|
|
224
|
+
- Acknowledges the problem
|
|
225
|
+
- Explains what was wrong
|
|
226
|
+
- Shows the fix
|
|
227
|
+
- Notes testing improvements
|
|
228
|
+
|
|
229
|
+
## Workflow Integration
|
|
230
|
+
|
|
231
|
+
### With PRs
|
|
232
|
+
|
|
233
|
+
Generate news when PR merges:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# In PR description
|
|
237
|
+
Closes #123
|
|
238
|
+
|
|
239
|
+
[News]
|
|
240
|
+
Title: Ship Features Faster With New Deployment Pipeline
|
|
241
|
+
Focus: Developer velocity, time savings
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Hook uses PR description to enhance article.
|
|
245
|
+
|
|
246
|
+
### With Releases
|
|
247
|
+
|
|
248
|
+
Generate comprehensive release notes:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
git tag v1.2.0 -m "Release v1.2.0
|
|
252
|
+
|
|
253
|
+
Features:
|
|
254
|
+
- Video upload
|
|
255
|
+
- GraphQL API
|
|
256
|
+
- Performance improvements"
|
|
257
|
+
|
|
258
|
+
# Hook generates release announcement
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## Quality Checklist
|
|
262
|
+
|
|
263
|
+
Before publishing, verify:
|
|
264
|
+
- [ ] Headline is benefit-focused
|
|
265
|
+
- [ ] Opening hooks attention in 2 sentences
|
|
266
|
+
- [ ] Technical accuracy (no BS)
|
|
267
|
+
- [ ] Code examples compile
|
|
268
|
+
- [ ] Links work
|
|
269
|
+
- [ ] Tone matches voice guidelines
|
|
270
|
+
- [ ] Scannable structure (headers, lists, code)
|
|
271
|
+
- [ ] Clear CTA
|
|
272
|
+
- [ ] Proper tags and metadata
|
|
273
|
+
- [ ] Today's date in frontmatter
|
|
274
|
+
|
|
275
|
+
## Troubleshooting
|
|
276
|
+
|
|
277
|
+
### Article Not Generated
|
|
278
|
+
|
|
279
|
+
**Check:**
|
|
280
|
+
1. Commit type is newsworthy (feat|fix|perf|refactor)
|
|
281
|
+
2. No `[skip-news]` flag in message
|
|
282
|
+
3. Hook script is executable: `chmod +x .claude/hooks/write-news.sh`
|
|
283
|
+
4. Hook is registered in `.git/hooks/post-commit`
|
|
284
|
+
|
|
285
|
+
### Article Quality Poor
|
|
286
|
+
|
|
287
|
+
**Improve:**
|
|
288
|
+
1. Write better commit messages (more context)
|
|
289
|
+
2. Customize agent-writer voice in `.claude/agents/agent-writer.md`
|
|
290
|
+
3. Edit generated article before publishing
|
|
291
|
+
4. Provide more detail in commit body
|
|
292
|
+
|
|
293
|
+
### Wrong Category/Tags
|
|
294
|
+
|
|
295
|
+
**Fix:**
|
|
296
|
+
1. Edit generated article frontmatter
|
|
297
|
+
2. Update hook logic in `.claude/hooks/write-news.sh`
|
|
298
|
+
3. Improve commit message format
|
|
299
|
+
|
|
300
|
+
## Best Practices
|
|
301
|
+
|
|
302
|
+
### Write Good Commit Messages
|
|
303
|
+
|
|
304
|
+
**Bad:**
|
|
305
|
+
```bash
|
|
306
|
+
git commit -m "update stuff"
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
**Good:**
|
|
310
|
+
```bash
|
|
311
|
+
git commit -m "feat: Add Cloudflare Stream integration for video uploads
|
|
312
|
+
|
|
313
|
+
Enables uploading videos up to 4K resolution without server storage.
|
|
314
|
+
Uses Cloudflare Stream API for processing and delivery.
|
|
315
|
+
Reduces infrastructure costs by 90%."
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
Better commits = better articles.
|
|
319
|
+
|
|
320
|
+
### Use Conventional Commits
|
|
321
|
+
|
|
322
|
+
```bash
|
|
323
|
+
type(scope): subject
|
|
324
|
+
|
|
325
|
+
body
|
|
326
|
+
|
|
327
|
+
footer
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
**Examples:**
|
|
331
|
+
```bash
|
|
332
|
+
feat(api): Add GraphQL endpoint with type generation
|
|
333
|
+
fix(auth): Resolve mobile session timeout on iOS
|
|
334
|
+
perf(build): Reduce bundle size from 800KB to 28KB
|
|
335
|
+
refactor(db): Migrate to edge-optimized queries
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Tag Strategically
|
|
339
|
+
|
|
340
|
+
Use tags that users search for:
|
|
341
|
+
- Technology: `graphql`, `react`, `cloudflare`
|
|
342
|
+
- Feature: `video`, `api`, `auth`
|
|
343
|
+
- Benefit: `performance`, `dx`, `security`
|
|
344
|
+
- Use case: `ecommerce`, `saas`, `education`
|
|
345
|
+
|
|
346
|
+
## Future Enhancements
|
|
347
|
+
|
|
348
|
+
**Coming:**
|
|
349
|
+
- ✅ Auto-generate from PR descriptions
|
|
350
|
+
- ✅ Multi-language translation
|
|
351
|
+
- ✅ Social media post generation
|
|
352
|
+
- ✅ Email newsletter compilation
|
|
353
|
+
- ✅ Video script generation
|
|
354
|
+
|
|
355
|
+
## Related Documentation
|
|
356
|
+
|
|
357
|
+
- **Agent Definition:** `.claude/agents/agent-writer.md`
|
|
358
|
+
- **Hook Script:** `.claude/hooks/write-news.sh`
|
|
359
|
+
- **Example Article:** `web/src/content/news/automated-news-generation-from-commits.md`
|
|
360
|
+
- **Content Schema:** `web/src/content/config.ts` (NewsSchema)
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
**Write code. Ship features. Generate news. Repeat.**
|
package/.claude/hooks/push.sh
CHANGED
|
@@ -3,13 +3,50 @@
|
|
|
3
3
|
# Push to all remotes: main repo + subtrees + one.ie
|
|
4
4
|
# Usage: ./.claude/hooks/push.sh [all|main|one|web|oneie]
|
|
5
5
|
#
|
|
6
|
-
# CRITICAL: This script ALWAYS
|
|
7
|
-
#
|
|
6
|
+
# CRITICAL: This script ALWAYS:
|
|
7
|
+
# 1. Stages all changes (git add -A)
|
|
8
|
+
# 2. Commits changes (if any exist)
|
|
9
|
+
# 3. Pulls before pushing to prevent branch divergence
|
|
10
|
+
# 4. Pushes to remotes
|
|
11
|
+
#
|
|
12
|
+
# Rule: Always add → commit → pull → push. Never skip steps.
|
|
8
13
|
|
|
9
14
|
set -e
|
|
10
15
|
|
|
11
16
|
COMMAND="${1:-all}"
|
|
12
17
|
|
|
18
|
+
# ============================================================
|
|
19
|
+
# STAGE AND COMMIT - Always commit changes before pushing
|
|
20
|
+
# ============================================================
|
|
21
|
+
commit_changes() {
|
|
22
|
+
echo "📋 Checking for uncommitted changes..."
|
|
23
|
+
|
|
24
|
+
# Check if there are changes to commit
|
|
25
|
+
if [[ -z $(git status --porcelain) ]]; then
|
|
26
|
+
echo "✅ No changes to commit"
|
|
27
|
+
return
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
echo "📝 Staging all changes..."
|
|
31
|
+
git add -A
|
|
32
|
+
|
|
33
|
+
# Generate commit message from changed files
|
|
34
|
+
CHANGED_FILES=$(git status --short | head -5 | awk '{print $2}' | tr '\n' ', ' | sed 's/,$//')
|
|
35
|
+
CHANGE_COUNT=$(git status --short | wc -l | tr -d ' ')
|
|
36
|
+
|
|
37
|
+
COMMIT_MSG="chore: Update $CHANGE_COUNT file(s)
|
|
38
|
+
|
|
39
|
+
Changed: $CHANGED_FILES
|
|
40
|
+
|
|
41
|
+
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
|
42
|
+
|
|
43
|
+
Co-Authored-By: Claude <noreply@anthropic.com>"
|
|
44
|
+
|
|
45
|
+
echo "💾 Committing changes..."
|
|
46
|
+
git commit -m "$COMMIT_MSG"
|
|
47
|
+
echo "✅ Changes committed"
|
|
48
|
+
}
|
|
49
|
+
|
|
13
50
|
# ============================================================
|
|
14
51
|
# PULL FIRST - Prevent branch divergence
|
|
15
52
|
# ============================================================
|
|
@@ -23,40 +60,46 @@ pull_main() {
|
|
|
23
60
|
echo "✅ Pulled latest changes"
|
|
24
61
|
}
|
|
25
62
|
|
|
26
|
-
|
|
63
|
+
# ============================================================
|
|
64
|
+
# PREPARE REPO - Stage, commit, and pull once before all pushes
|
|
65
|
+
# ============================================================
|
|
66
|
+
prepare_repo() {
|
|
67
|
+
# Commit changes first (if any)
|
|
68
|
+
commit_changes
|
|
69
|
+
echo ""
|
|
70
|
+
|
|
27
71
|
# Pull first (CRITICAL - prevents divergence)
|
|
28
72
|
pull_main
|
|
29
73
|
echo ""
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
push_main() {
|
|
30
77
|
echo "📤 Pushing main repo to origin (one-ie/one)..."
|
|
31
78
|
git push origin main
|
|
32
79
|
echo "✅ Main repo pushed"
|
|
33
80
|
}
|
|
34
81
|
|
|
35
82
|
push_one() {
|
|
36
|
-
# Pull first (CRITICAL - prevents divergence)
|
|
37
|
-
pull_main
|
|
38
|
-
echo ""
|
|
39
83
|
echo "📤 Pushing /one subtree to one-repo (one-ie/ontology)..."
|
|
40
84
|
git push one-repo $(git subtree split --prefix one main):main --force
|
|
41
85
|
echo "✅ /one subtree pushed"
|
|
42
86
|
}
|
|
43
87
|
|
|
44
88
|
push_web() {
|
|
45
|
-
# Pull first (CRITICAL - prevents divergence)
|
|
46
|
-
pull_main
|
|
47
|
-
echo ""
|
|
48
89
|
echo "📤 Pushing /web subtree to web-repo (one-ie/web)..."
|
|
49
90
|
git push web-repo $(git subtree split --prefix web main):main --force
|
|
50
91
|
echo "✅ /web subtree pushed"
|
|
51
92
|
}
|
|
52
93
|
|
|
53
94
|
push_oneie() {
|
|
54
|
-
# Pull first (CRITICAL - prevents divergence)
|
|
55
|
-
pull_main
|
|
56
|
-
echo ""
|
|
57
95
|
echo "📤 Pushing to one.ie repo (one-ie/one.ie)..."
|
|
58
96
|
if [ -d "one.ie" ]; then
|
|
59
97
|
cd one.ie
|
|
98
|
+
# Check for changes and commit
|
|
99
|
+
if [[ -n $(git status --porcelain) ]]; then
|
|
100
|
+
git add -A
|
|
101
|
+
git commit -m "chore: Sync from main repo"
|
|
102
|
+
fi
|
|
60
103
|
# Pull in one.ie directory too
|
|
61
104
|
git pull origin main --ff-only 2>/dev/null || git pull origin main --no-rebase
|
|
62
105
|
git push origin main
|
|
@@ -69,22 +112,31 @@ push_oneie() {
|
|
|
69
112
|
|
|
70
113
|
case "$COMMAND" in
|
|
71
114
|
all)
|
|
115
|
+
prepare_repo
|
|
72
116
|
push_main
|
|
117
|
+
echo ""
|
|
73
118
|
push_one
|
|
119
|
+
echo ""
|
|
74
120
|
push_web
|
|
121
|
+
echo ""
|
|
75
122
|
push_oneie
|
|
123
|
+
echo ""
|
|
76
124
|
echo "🎉 All remotes synced!"
|
|
77
125
|
;;
|
|
78
126
|
main)
|
|
127
|
+
prepare_repo
|
|
79
128
|
push_main
|
|
80
129
|
;;
|
|
81
130
|
one)
|
|
131
|
+
prepare_repo
|
|
82
132
|
push_one
|
|
83
133
|
;;
|
|
84
134
|
web)
|
|
135
|
+
prepare_repo
|
|
85
136
|
push_web
|
|
86
137
|
;;
|
|
87
138
|
oneie)
|
|
139
|
+
prepare_repo
|
|
88
140
|
push_oneie
|
|
89
141
|
;;
|
|
90
142
|
*)
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Write News Hook - Auto-generate news articles from git commits
|
|
4
|
+
# Invokes agent-writer to create engaging content about platform changes
|
|
5
|
+
|
|
6
|
+
PROJECT_DIR="$(git rev-parse --show-toplevel)"
|
|
7
|
+
HOOKS_DIR="$PROJECT_DIR/.claude/hooks"
|
|
8
|
+
NEWS_DIR="$PROJECT_DIR/web/src/content/news"
|
|
9
|
+
|
|
10
|
+
# Get the last commit info
|
|
11
|
+
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
|
|
12
|
+
COMMIT_HASH=$(git log -1 --pretty=%H)
|
|
13
|
+
COMMIT_DATE=$(date +%Y-%m-%d)
|
|
14
|
+
COMMIT_FILES=$(git diff-tree --no-commit-id --name-only -r HEAD | head -20)
|
|
15
|
+
COMMIT_STATS=$(git diff HEAD~1 HEAD --shortstat)
|
|
16
|
+
|
|
17
|
+
# Extract commit type (feat|fix|docs|refactor|perf|test)
|
|
18
|
+
COMMIT_TYPE=$(echo "$COMMIT_MESSAGE" | grep -oE '^(feat|fix|docs|refactor|perf|test|chore|style|build|ci)' | head -1)
|
|
19
|
+
|
|
20
|
+
# Skip if not newsworthy
|
|
21
|
+
if [[ "$COMMIT_TYPE" == "docs" ]] || [[ "$COMMIT_TYPE" == "chore" ]] || [[ "$COMMIT_TYPE" == "style" ]] || [[ "$COMMIT_TYPE" == "test" ]]; then
|
|
22
|
+
echo "✓ Skipping news generation for $COMMIT_TYPE commit"
|
|
23
|
+
exit 0
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
# Skip if commit message contains [skip-news] or [no-news]
|
|
27
|
+
if echo "$COMMIT_MESSAGE" | grep -qiE '\[(skip-news|no-news)\]'; then
|
|
28
|
+
echo "✓ Skipping news generation ([skip-news] flag detected)"
|
|
29
|
+
exit 0
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
# Determine category based on commit type
|
|
33
|
+
case "$COMMIT_TYPE" in
|
|
34
|
+
feat)
|
|
35
|
+
CATEGORY="feature"
|
|
36
|
+
TYPE="feature_update"
|
|
37
|
+
;;
|
|
38
|
+
fix)
|
|
39
|
+
CATEGORY="infrastructure"
|
|
40
|
+
TYPE="bug_fix"
|
|
41
|
+
;;
|
|
42
|
+
perf)
|
|
43
|
+
CATEGORY="article"
|
|
44
|
+
TYPE="performance"
|
|
45
|
+
;;
|
|
46
|
+
refactor)
|
|
47
|
+
CATEGORY="infrastructure"
|
|
48
|
+
TYPE="architecture"
|
|
49
|
+
;;
|
|
50
|
+
*)
|
|
51
|
+
CATEGORY="article"
|
|
52
|
+
TYPE="update"
|
|
53
|
+
;;
|
|
54
|
+
esac
|
|
55
|
+
|
|
56
|
+
# Determine repo from changed files
|
|
57
|
+
REPO="one"
|
|
58
|
+
if echo "$COMMIT_FILES" | grep -q "^web/"; then
|
|
59
|
+
REPO="web"
|
|
60
|
+
elif echo "$COMMIT_FILES" | grep -q "^backend/"; then
|
|
61
|
+
REPO="backend"
|
|
62
|
+
elif echo "$COMMIT_FILES" | grep -q "^cli/"; then
|
|
63
|
+
REPO="cli"
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
# Generate descriptive slug from commit message
|
|
67
|
+
# Remove type prefix, convert to lowercase, replace spaces with hyphens
|
|
68
|
+
SLUG=$(echo "$COMMIT_MESSAGE" | \
|
|
69
|
+
sed -E 's/^(feat|fix|docs|refactor|perf|test|chore|style|build|ci)[:(]//i' | \
|
|
70
|
+
sed -E 's/\)://g' | \
|
|
71
|
+
sed -E 's/[^a-zA-Z0-9 -]//g' | \
|
|
72
|
+
tr '[:upper:]' '[:lower:]' | \
|
|
73
|
+
tr -s ' ' '-' | \
|
|
74
|
+
sed 's/^-//;s/-$//' | \
|
|
75
|
+
cut -c1-60)
|
|
76
|
+
|
|
77
|
+
# Create news file path (slug only, no date in filename)
|
|
78
|
+
NEWS_FILE="$NEWS_DIR/${SLUG}.md"
|
|
79
|
+
|
|
80
|
+
# Skip if file already exists
|
|
81
|
+
if [ -f "$NEWS_FILE" ]; then
|
|
82
|
+
echo "✓ News article already exists: $SLUG.md"
|
|
83
|
+
exit 0
|
|
84
|
+
fi
|
|
85
|
+
|
|
86
|
+
# Prepare context for agent-writer
|
|
87
|
+
CONTEXT=$(cat <<EOF
|
|
88
|
+
# News Article Request
|
|
89
|
+
|
|
90
|
+
## Commit Information
|
|
91
|
+
|
|
92
|
+
**Message:** $COMMIT_MESSAGE
|
|
93
|
+
**Hash:** $COMMIT_HASH
|
|
94
|
+
**Date:** $COMMIT_DATE
|
|
95
|
+
**Type:** $COMMIT_TYPE
|
|
96
|
+
**Category:** $CATEGORY
|
|
97
|
+
**Repo:** $REPO
|
|
98
|
+
|
|
99
|
+
## Files Changed
|
|
100
|
+
|
|
101
|
+
\`\`\`
|
|
102
|
+
$COMMIT_FILES
|
|
103
|
+
\`\`\`
|
|
104
|
+
|
|
105
|
+
## Stats
|
|
106
|
+
|
|
107
|
+
$COMMIT_STATS
|
|
108
|
+
|
|
109
|
+
## Your Task
|
|
110
|
+
|
|
111
|
+
Write an engaging news article about this change for \`web/src/content/news/${SLUG}.md\`.
|
|
112
|
+
|
|
113
|
+
**Requirements:**
|
|
114
|
+
1. Use today's date ($COMMIT_DATE) in frontmatter
|
|
115
|
+
2. Follow the agent-writer voice guidelines (authority, humor, warmth, education)
|
|
116
|
+
3. Make it newsworthy—focus on user benefits, not just code changes
|
|
117
|
+
4. Include practical examples where relevant
|
|
118
|
+
5. Keep it scannable (short paragraphs, headers, code blocks)
|
|
119
|
+
6. Write in the style of Alex Hormozi, Wired, Ars Technica, Fast Company
|
|
120
|
+
|
|
121
|
+
**Frontmatter template:**
|
|
122
|
+
|
|
123
|
+
\`\`\`yaml
|
|
124
|
+
---
|
|
125
|
+
title: "[Benefit-Focused Headline]"
|
|
126
|
+
date: $COMMIT_DATE
|
|
127
|
+
description: "One-sentence value proposition"
|
|
128
|
+
author: "ONE Platform Team"
|
|
129
|
+
type: "$TYPE"
|
|
130
|
+
tags: ["tag1", "tag2", "tag3"]
|
|
131
|
+
category: "$CATEGORY"
|
|
132
|
+
repo: "$REPO"
|
|
133
|
+
draft: false
|
|
134
|
+
---
|
|
135
|
+
\`\`\`
|
|
136
|
+
|
|
137
|
+
**Article structure:**
|
|
138
|
+
1. **What Changed** - Clear explanation of the update
|
|
139
|
+
2. **Why This Matters** - Connect to user needs/pain points
|
|
140
|
+
3. **How It Works** - Technical details with examples
|
|
141
|
+
4. **What You Can Do Now** - Clear next steps
|
|
142
|
+
|
|
143
|
+
Make it compelling. Make people care.
|
|
144
|
+
EOF
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
# Create temporary file for agent-writer output
|
|
148
|
+
TEMP_FILE=$(mktemp)
|
|
149
|
+
|
|
150
|
+
# Write context to temp file
|
|
151
|
+
echo "$CONTEXT" > "$TEMP_FILE"
|
|
152
|
+
|
|
153
|
+
echo ""
|
|
154
|
+
echo "📝 Generating news article for: $COMMIT_MESSAGE"
|
|
155
|
+
echo " File: $SLUG.md"
|
|
156
|
+
echo " Category: $CATEGORY"
|
|
157
|
+
echo " Repo: $REPO"
|
|
158
|
+
echo ""
|
|
159
|
+
|
|
160
|
+
# Note: This hook prepares the context but doesn't auto-generate
|
|
161
|
+
# To enable auto-generation, uncomment the following and install Claude Code CLI:
|
|
162
|
+
|
|
163
|
+
# # Invoke agent-writer via Claude Code (if available)
|
|
164
|
+
# if command -v claude &> /dev/null; then
|
|
165
|
+
# claude task --agent agent-writer --prompt "$(cat $TEMP_FILE)" --output "$NEWS_FILE"
|
|
166
|
+
# if [ $? -eq 0 ]; then
|
|
167
|
+
# echo "✓ News article generated: $NEWS_FILE"
|
|
168
|
+
# # Stage the new file
|
|
169
|
+
# git add "$NEWS_FILE"
|
|
170
|
+
# else
|
|
171
|
+
# echo "✗ Failed to generate news article"
|
|
172
|
+
# fi
|
|
173
|
+
# else
|
|
174
|
+
# echo "⚠️ Claude Code CLI not found. To enable auto-generation:"
|
|
175
|
+
# echo " 1. Install Claude Code CLI"
|
|
176
|
+
# echo " 2. Uncomment the generation code in .claude/hooks/write-news.sh"
|
|
177
|
+
# fi
|
|
178
|
+
|
|
179
|
+
# Manual workflow for now
|
|
180
|
+
echo "📋 Context prepared. To generate the article:"
|
|
181
|
+
echo ""
|
|
182
|
+
echo " Ask Claude Code:"
|
|
183
|
+
echo " 'Use agent-writer to create a news article from this commit:'"
|
|
184
|
+
echo " Then paste this context or run:"
|
|
185
|
+
echo ""
|
|
186
|
+
echo " cat $TEMP_FILE"
|
|
187
|
+
echo ""
|
|
188
|
+
echo " Save output to: $NEWS_FILE"
|
|
189
|
+
echo ""
|
|
190
|
+
|
|
191
|
+
# Keep temp file for manual use
|
|
192
|
+
echo "$TEMP_FILE" > "$HOOKS_DIR/.last-news-context"
|
|
193
|
+
|
|
194
|
+
exit 0
|