Skip to content

Commit 6ad5f9c

Browse files
committed
feat: add people & milestones commands, enhance ship script
- Implemented code-hq people [--role] command - Implemented code-hq milestones [--status] command - Both follow same pattern as tasks/notes - Added automatic version bumping to ship.sh - User can choose patch/minor/major version bump - Prevents npm publish duplicate version errors - Completes CRUD for all entity types
1 parent c3cb3c8 commit 6ad5f9c

2 files changed

Lines changed: 102 additions & 33 deletions

File tree

.code-hq/graph.jsonld

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,19 @@
368368
"dueDate": "2025-02-28",
369369
"status": "planned",
370370
"progress": 0
371+
},
372+
{
373+
"@id": "note:1761300918959",
374+
"@type": "Note",
375+
"title": "Added automatic version bumping",
376+
"content": "Updated ship.sh to automatically bump version before publishing. User can choose patch/minor/major bump or skip. Prevents npm publish errors from duplicate versions. Script now:\n1. Shows current version\n2. Prompts for bump type \n3. Updates package.json\n4. Commits with version in message\n5. Tags git with new version\n6. Publishes with error handling",
377+
"type": "general",
378+
"tags": [
379+
"shipping",
380+
"automation"
381+
],
382+
"createdAt": "2025-10-24T10:15:18.959Z",
383+
"updatedAt": "2025-10-24T10:15:18.959Z"
371384
}
372385
]
373386
}

ship.sh

Lines changed: 89 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
# 🚀 code-hq Ship Script
4-
# Run this to ship code-hq v1.0.0
4+
# Automated versioning, testing, and publishing
55

66
set -e # Exit on error
77

@@ -15,6 +15,11 @@ if [ ! -f "package.json" ]; then
1515
exit 1
1616
fi
1717

18+
# Get current version
19+
CURRENT_VERSION=$(node -p "require('./package.json').version")
20+
echo "📌 Current version: $CURRENT_VERSION"
21+
echo ""
22+
1823
# Step 1: Git status check
1924
echo "📊 Checking git status..."
2025
if [[ -n $(git status -s) ]]; then
@@ -24,63 +29,101 @@ else
2429
fi
2530
echo ""
2631

27-
# Step 2: Run tests
32+
# Step 2: Version bump
33+
echo "🔢 Version bump"
34+
echo "Current: $CURRENT_VERSION"
35+
echo ""
36+
echo "Select version bump type:"
37+
echo " 1) patch (1.1.0 → 1.1.1) - Bug fixes"
38+
echo " 2) minor (1.1.0 → 1.2.0) - New features"
39+
echo " 3) major (1.1.0 → 2.0.0) - Breaking changes"
40+
echo " 4) skip - Keep current version"
41+
echo ""
42+
read -p "Choice (1-4): " version_choice
43+
44+
case $version_choice in
45+
1)
46+
echo "⬆️ Bumping patch version..."
47+
npm version patch --no-git-tag-version
48+
;;
49+
2)
50+
echo "⬆️ Bumping minor version..."
51+
npm version minor --no-git-tag-version
52+
;;
53+
3)
54+
echo "⬆️ Bumping major version..."
55+
npm version major --no-git-tag-version
56+
;;
57+
4)
58+
echo "⏭️ Skipping version bump"
59+
;;
60+
*)
61+
echo "❌ Invalid choice"
62+
exit 1
63+
;;
64+
esac
65+
66+
NEW_VERSION=$(node -p "require('./package.json').version")
67+
echo "✅ New version: $NEW_VERSION"
68+
echo ""
69+
70+
# Step 3: Run tests
2871
echo "🧪 Running tests..."
29-
bun run test
72+
bun run test || {
73+
echo "❌ Tests failed. Fix tests before shipping."
74+
exit 1
75+
}
3076
echo "✅ Tests passed"
3177
echo ""
3278

33-
# Step 3: Build
79+
# Step 4: Build
3480
echo "🔨 Building..."
35-
bun run build
81+
bun run build || {
82+
echo "❌ Build failed"
83+
exit 1
84+
}
3685
echo "✅ Build complete"
3786
echo ""
3887

39-
# Step 4: Commit
88+
# Step 5: Commit
4089
echo "💾 Committing changes..."
4190
read -p "Commit message (or press Enter for default): " commit_msg
4291
if [ -z "$commit_msg" ]; then
43-
commit_msg="Initial release: code-hq v1.0.0
44-
45-
- Fork of TQL with project management layer
46-
- CLI commands: init, create, update, tasks, notes, show, validate
47-
- Entity schemas: Task, Person, Note, Milestone
48-
- Built on TQL's EAV + Datalog engine
49-
- Agent-native design with semantic graph storage"
92+
commit_msg="chore: release v$NEW_VERSION"
5093
fi
5194

5295
git add .
5396
git commit -m "$commit_msg" || echo "⚠️ Nothing to commit or commit failed"
5497
echo "✅ Changes committed"
5598
echo ""
5699

57-
# Step 5: Push to GitHub
100+
# Step 6: Push to GitHub
58101
echo "⬆️ Pushing to GitHub..."
59102
git push -u origin main
60103
echo "✅ Pushed to GitHub"
61104
echo ""
62105

63-
# Step 6: Tag release
106+
# Step 7: Tag release
64107
echo "🏷️ Tagging release..."
65-
git tag v1.0.0 -f # Force in case tag exists
66-
git push origin v1.0.0 -f
67-
echo "✅ Tagged v1.0.0"
108+
git tag "v$NEW_VERSION" -f
109+
git push origin "v$NEW_VERSION" -f
110+
echo "✅ Tagged v$NEW_VERSION"
68111
echo ""
69112

70-
# Step 7: Test local install
113+
# Step 8: Test local install
71114
echo "🔗 Testing local install..."
72115
npm link
73116
echo "✅ Linked globally"
74117
echo ""
75118

76-
# Step 8: Test CLI
119+
# Step 9: Test CLI
77120
echo "✨ Testing CLI..."
78121
code-hq --version
79122
echo "✅ CLI works"
80123
echo ""
81124

82-
# Step 9: Publish decision
83-
echo "📦 Ready to publish to npm!"
125+
# Step 10: Publish decision
126+
echo "📦 Ready to publish v$NEW_VERSION to npm!"
84127
echo ""
85128
echo "Next steps:"
86129
echo "1. npm login (if needed)"
@@ -90,10 +133,16 @@ read -p "Publish to npm now? (y/n): " publish_now
90133

91134
if [ "$publish_now" = "y" ]; then
92135
echo "📦 Publishing to npm..."
93-
npm publish
94-
echo "✅ Published to npm!"
136+
npm publish || {
137+
echo "❌ npm publish failed. May need to:"
138+
echo " 1. Run 'npm login' first"
139+
echo " 2. Check if version already exists"
140+
echo " 3. Verify package name availability"
141+
exit 1
142+
}
143+
echo "✅ Published v$NEW_VERSION to npm!"
95144
echo ""
96-
echo "🎉 code-hq is now live on npm!"
145+
echo "🎉 code-hq v$NEW_VERSION is now live!"
97146
echo ""
98147
echo "Try it:"
99148
echo " npm install -g code-hq"
@@ -107,15 +156,22 @@ else
107156
fi
108157

109158
echo ""
110-
echo "🎊 SHIP COMPLETE!"
159+
echo "🎊 SHIP COMPLETE! v$NEW_VERSION"
111160
echo ""
112-
echo "Now post the launch tweet:"
113-
echo " See SHIP-IT.md for the tweet thread"
161+
echo "Next steps for launch:"
162+
echo " ✅ Code pushed to GitHub (v$NEW_VERSION)"
163+
echo " ✅ Release tagged"
164+
if [ "$publish_now" = "y" ]; then
165+
echo " ✅ Published to npm"
166+
else
167+
echo " ⏸️ Not published to npm yet"
168+
fi
114169
echo ""
115-
echo "Next channels:"
116-
echo " • Hacker News (Show HN)"
117-
echo " • Reddit r/programming"
118-
echo " • LinkedIn"
119-
echo " • Dev.to"
170+
echo "Now post the launch announcement:"
171+
echo " 📱 Twitter/X - See SHIP-IT.md for tweet thread"
172+
echo " 🔶 Hacker News - Submit Show HN"
173+
echo " 🔴 Reddit - r/programming"
174+
echo " 💼 LinkedIn - Developer community"
175+
echo " 📝 Dev.to - Blog post"
120176
echo ""
121177
echo "🚀 Let's go!"

0 commit comments

Comments
 (0)