Skip to content

Commit 6404232

Browse files
carlrannabergclaude
andcommitted
feat: implement Simple Task Master CLI library
Initial implementation of a file-based task management system with the following features: Core Features: - File-based task storage using Markdown with YAML frontmatter - Atomic operations with PID-based locking mechanism - ID generation using filesystem scan (highest + 1) - Support for task dependencies and tags - Multiple export formats (JSON, CSV, Markdown, YAML, NDJSON) Commands: - add: Create new tasks with automatic ID assignment - list: List tasks with filtering by status, tags, and date ranges - show: Display individual tasks in various formats - update: Modify existing tasks (title, status, tags, dependencies) - export: Export tasks in multiple formats - grep: Search task content using regex patterns Architecture: - TypeScript implementation with strict typing - Modular command structure using yargs - Comprehensive error handling with custom error types - Lock manager with 30s timeout and automatic cleanup - Optimized ID generation with data integrity checks Testing: - Unit tests for all commands and core functionality - Integration tests for CLI operations - E2E tests for real-world scenarios - Performance benchmarks Build & Release: - Automated GitHub Actions for testing and releases - AI-powered release script with changelog generation - Support for both Claude and Gemini CLI tools - README validation and auto-update capability Configuration: - User config file support (~/.simple-task-master/config.json) - Customizable task directory location - Claude Code integration with hooks - ESLint and Prettier configuration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 9c54c58 commit 6404232

79 files changed

Lines changed: 19716 additions & 7 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@
5050
}
5151
]
5252
}
53-
}
53+
}

.github/workflows/release.yaml

Lines changed: 330 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,330 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Version to release (e.g., 1.0.0)'
11+
required: true
12+
type: string
13+
dry_run:
14+
description: 'Dry run (skip actual publishing)'
15+
required: false
16+
default: false
17+
type: boolean
18+
19+
concurrency:
20+
group: release-${{ github.ref }}
21+
cancel-in-progress: false
22+
23+
jobs:
24+
check-version:
25+
name: Version Check
26+
runs-on: ubuntu-latest
27+
outputs:
28+
version: ${{ steps.version.outputs.version }}
29+
tag: ${{ steps.version.outputs.tag }}
30+
is_prerelease: ${{ steps.version.outputs.is_prerelease }}
31+
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
38+
- name: Extract version information
39+
id: version
40+
run: |
41+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
42+
VERSION="${{ github.event.inputs.version }}"
43+
TAG="v${VERSION}"
44+
else
45+
TAG="${{ github.ref_name }}"
46+
VERSION="${TAG#v}"
47+
fi
48+
49+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
50+
echo "tag=${TAG}" >> $GITHUB_OUTPUT
51+
52+
# Check if this is a prerelease (contains alpha, beta, rc)
53+
if [[ "${VERSION}" =~ (alpha|beta|rc) ]]; then
54+
echo "is_prerelease=true" >> $GITHUB_OUTPUT
55+
else
56+
echo "is_prerelease=false" >> $GITHUB_OUTPUT
57+
fi
58+
59+
echo "Detected version: ${VERSION}"
60+
echo "Tag: ${TAG}"
61+
62+
- name: Validate version format
63+
run: |
64+
VERSION="${{ steps.version.outputs.version }}"
65+
if [[ ! "${VERSION}" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+(\.[0-9]+)?)?$ ]]; then
66+
echo "❌ Invalid version format: ${VERSION}"
67+
echo "Expected format: X.Y.Z or X.Y.Z-prerelease"
68+
exit 1
69+
fi
70+
echo "✅ Version format is valid: ${VERSION}"
71+
72+
- name: Check if version exists in package.json
73+
run: |
74+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
75+
RELEASE_VERSION="${{ steps.version.outputs.version }}"
76+
77+
if [[ "${PACKAGE_VERSION}" != "${RELEASE_VERSION}" ]]; then
78+
echo "❌ Version mismatch!"
79+
echo "package.json version: ${PACKAGE_VERSION}"
80+
echo "Release version: ${RELEASE_VERSION}"
81+
echo "Please update package.json version to match the release version"
82+
exit 1
83+
fi
84+
echo "✅ Version matches package.json: ${RELEASE_VERSION}"
85+
86+
test:
87+
name: Run Tests
88+
needs: check-version
89+
uses: ./.github/workflows/test.yaml
90+
91+
build:
92+
name: Build Package
93+
runs-on: ubuntu-latest
94+
needs: [check-version, test]
95+
96+
steps:
97+
- name: Checkout repository
98+
uses: actions/checkout@v4
99+
100+
- name: Setup Node.js
101+
uses: actions/setup-node@v4
102+
with:
103+
node-version: '20.x'
104+
cache: 'npm'
105+
106+
- name: Install dependencies
107+
run: npm ci
108+
109+
- name: Build project
110+
run: npm run build
111+
112+
- name: Create package
113+
run: npm pack
114+
115+
- name: Upload package artifact
116+
uses: actions/upload-artifact@v4
117+
with:
118+
name: npm-package
119+
path: simple-task-master-*.tgz
120+
retention-days: 30
121+
122+
publish-npm:
123+
name: Publish to NPM
124+
runs-on: ubuntu-latest
125+
needs: [check-version, build]
126+
if: github.event.inputs.dry_run != 'true'
127+
environment: npm-release
128+
129+
steps:
130+
- name: Checkout repository
131+
uses: actions/checkout@v4
132+
133+
- name: Setup Node.js
134+
uses: actions/setup-node@v4
135+
with:
136+
node-version: '20.x'
137+
cache: 'npm'
138+
registry-url: 'https://registry.npmjs.org'
139+
140+
- name: Install dependencies
141+
run: npm ci
142+
143+
- name: Build project
144+
run: npm run build
145+
146+
- name: Publish to NPM
147+
env:
148+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
149+
run: |
150+
if [[ "${{ needs.check-version.outputs.is_prerelease }}" == "true" ]]; then
151+
echo "Publishing prerelease to NPM with --tag next"
152+
npm publish --tag next --provenance
153+
else
154+
echo "Publishing stable release to NPM"
155+
npm publish --provenance
156+
fi
157+
158+
- name: Verify NPM publication
159+
run: |
160+
VERSION="${{ needs.check-version.outputs.version }}"
161+
sleep 30 # Give NPM some time to propagate
162+
163+
# Check if the version is available
164+
if npm view simple-task-master@${VERSION} version; then
165+
echo "✅ Package successfully published to NPM"
166+
else
167+
echo "❌ Package publication verification failed"
168+
exit 1
169+
fi
170+
171+
create-github-release:
172+
name: Create GitHub Release
173+
runs-on: ubuntu-latest
174+
needs: [check-version, build]
175+
if: github.event.inputs.dry_run != 'true'
176+
177+
steps:
178+
- name: Checkout repository
179+
uses: actions/checkout@v4
180+
with:
181+
fetch-depth: 0
182+
183+
- name: Download package artifact
184+
uses: actions/download-artifact@v4
185+
with:
186+
name: npm-package
187+
188+
- name: Extract changelog for this version
189+
id: changelog
190+
run: |
191+
VERSION="${{ needs.check-version.outputs.version }}"
192+
193+
# Extract changelog section for this version
194+
awk "/^## \[${VERSION}\]/{flag=1; next} /^## \[/{flag=0} flag" CHANGELOG.md > release_notes.md
195+
196+
if [[ ! -s release_notes.md ]]; then
197+
echo "⚠️ No changelog found for version ${VERSION}, using generic release notes"
198+
cat > release_notes.md << EOF
199+
## Release ${VERSION}
200+
201+
This release includes various improvements and bug fixes.
202+
203+
### Installation
204+
\`\`\`bash
205+
npm install -g simple-task-master@${VERSION}
206+
\`\`\`
207+
208+
### Usage
209+
\`\`\`bash
210+
npx simple-task-master@${VERSION} init
211+
\`\`\`
212+
213+
For full documentation, see the [README](https://github.com/your-username/simple-task-master/blob/${VERSION}/README.md).
214+
EOF
215+
fi
216+
217+
# Add installation instructions
218+
cat >> release_notes.md << EOF
219+
220+
---
221+
222+
### 📦 Installation
223+
224+
**Global installation:**
225+
\`\`\`bash
226+
npm install -g simple-task-master@${VERSION}
227+
\`\`\`
228+
229+
**Using npx:**
230+
\`\`\`bash
231+
npx simple-task-master@${VERSION} init
232+
\`\`\`
233+
234+
### 🔗 Links
235+
- [NPM Package](https://www.npmjs.com/package/simple-task-master/v/${VERSION})
236+
- [Documentation](https://github.com/your-username/simple-task-master/blob/${VERSION}/README.md)
237+
- [Changelog](https://github.com/your-username/simple-task-master/blob/${VERSION}/CHANGELOG.md)
238+
239+
---
240+
241+
🤖 Generated with [Claude Code](https://claude.ai/code)
242+
EOF
243+
244+
echo "Release notes preview:"
245+
cat release_notes.md
246+
247+
- name: Create GitHub Release
248+
uses: softprops/action-gh-release@v2
249+
with:
250+
tag_name: ${{ needs.check-version.outputs.tag }}
251+
name: Release ${{ needs.check-version.outputs.version }}
252+
body_path: release_notes.md
253+
prerelease: ${{ needs.check-version.outputs.is_prerelease }}
254+
files: |
255+
simple-task-master-*.tgz
256+
generate_release_notes: true
257+
make_latest: ${{ needs.check-version.outputs.is_prerelease == 'false' }}
258+
env:
259+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
260+
261+
notify:
262+
name: Post-Release Notifications
263+
runs-on: ubuntu-latest
264+
needs: [check-version, publish-npm, create-github-release]
265+
if: success() && github.event.inputs.dry_run != 'true'
266+
267+
steps:
268+
- name: Checkout repository
269+
uses: actions/checkout@v4
270+
271+
- name: Create release summary
272+
run: |
273+
VERSION="${{ needs.check-version.outputs.version }}"
274+
TAG="${{ needs.check-version.outputs.tag }}"
275+
IS_PRERELEASE="${{ needs.check-version.outputs.is_prerelease }}"
276+
277+
cat > release_summary.md << EOF
278+
# 🚀 Simple Task Master ${VERSION} Released!
279+
280+
## What's New
281+
Simple Task Master ${VERSION} has been successfully released and is now available!
282+
283+
## 📦 Installation
284+
\`\`\`bash
285+
# Global installation
286+
npm install -g simple-task-master@${VERSION}
287+
288+
# Or use npx
289+
npx simple-task-master@${VERSION} init
290+
\`\`\`
291+
292+
## 🔗 Links
293+
- **NPM Package**: https://www.npmjs.com/package/simple-task-master/v/${VERSION}
294+
- **GitHub Release**: https://github.com/your-username/simple-task-master/releases/tag/${TAG}
295+
- **Documentation**: https://github.com/your-username/simple-task-master/blob/${TAG}/README.md
296+
297+
## 📊 Release Stats
298+
- **Version**: ${VERSION}
299+
- **Tag**: ${TAG}
300+
- **Prerelease**: ${IS_PRERELEASE}
301+
- **Build Date**: $(date -u +'%Y-%m-%d %H:%M:%S UTC')
302+
303+
EOF
304+
305+
echo "📋 Release Summary:"
306+
cat release_summary.md
307+
308+
- name: Update GitHub release with additional info
309+
run: |
310+
echo "✅ Release pipeline completed successfully!"
311+
echo "📦 NPM: https://www.npmjs.com/package/simple-task-master/v/${{ needs.check-version.outputs.version }}"
312+
echo "🏷️ GitHub: https://github.com/your-username/simple-task-master/releases/tag/${{ needs.check-version.outputs.tag }}"
313+
314+
cleanup:
315+
name: Cleanup
316+
runs-on: ubuntu-latest
317+
needs: [check-version, publish-npm, create-github-release, notify]
318+
if: always()
319+
320+
steps:
321+
- name: Cleanup artifacts
322+
uses: actions/download-artifact@v4
323+
with:
324+
name: npm-package
325+
path: cleanup/
326+
327+
- name: Remove temporary files
328+
run: |
329+
rm -rf cleanup/
330+
echo "🧹 Cleanup completed"

0 commit comments

Comments
 (0)