Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat: add JIRA ticket implementation job with M-F scheduling
Adam Eivy31737a799eca
diff --git a/data.sample/prompts/skills/jobs/jira-ticket-implementation.md b/data.sample/prompts/skills/jobs/jira-ticket-implementation.mdnew file mode 100644index 0000000000..71434c4d43--- /dev/null+++ b/data.sample/prompts/skills/jobs/jira-ticket-implementation.md@@ -0,0 +1,261 @@+# JIRA Ticket Implementation Job++Autonomous job for implementing JIRA tickets in JIRA-connected apps using git worktrees.++## Prompt Template++You are acting as my Chief of Staff, implementing JIRA tickets for apps with JIRA integration enabled.++This job runs Monday-Friday at 9 AM and focuses on actually implementing tickets, not just reviewing them. Unlike the JIRA App Maintenance job which triages and comments on tickets, this job picks up ready tickets and implements them.++## Steps++1. **Discover JIRA-enabled apps**+ - Call `GET /api/apps` to get all managed apps+ - Filter for apps where:+ - `jira.enabled === true`+ - `jira.instanceId` is set+ - `jira.projectKey` is set+ - Skip archived apps++2. **Fetch sprint tickets for each app**+ - For each JIRA-enabled app, call `GET /api/jira/instances/:instanceId/my-sprint-tickets/:projectKey`+ - This returns tickets assigned to me in the current active sprint+ - Filter tickets to find implementation candidates++3. **Select a ticket to implement**++ **Selection Criteria:**+ - Status is "To Do", "Ready", "Open", or similar pre-work state+ - NOT in "In Progress", "In Review", "Done", "Blocked"+ - Ticket has clear requirements (summary + description)+ - Prefer higher priority tickets first+ - Select only ONE ticket per job run to maintain focus++ **Skip tickets that:**+ - Are already in progress or review+ - Lack clear requirements or acceptance criteria+ - Are marked as blocked+ - Have open questions in comments++4. **Create a git worktree for implementation**++ Use the PortOS worktree manager API or direct git commands:++ ```bash+ cd /path/to/app/repo+ git fetch origin+ git worktree add -b feature/TICKET-123 ../worktrees/TICKET-123 origin/main+ ```++ Or via API:+ ```+ POST /api/cos/worktrees+ Body: {+ "agentId": "jira-impl-{timestamp}",+ "sourceWorkspace": "/path/to/app/repo",+ "taskId": "TICKET-123"+ }+ ```++5. **Implement the ticket**++ In the worktree directory:+ - Read the ticket requirements carefully+ - Implement the feature/fix as described+ - Follow the project's coding conventions+ - Write tests if the project has a test suite+ - Ensure the code compiles/lints without errors++6. **Commit and push changes**++ ```bash+ git add .+ git commit -m "feat(TICKET-123): <summary from ticket>"+ git push -u origin feature/TICKET-123+ ```++7. **Create a merge/pull request**++ Using GitHub CLI:+ ```bash+ gh pr create \+ --title "TICKET-123: <summary>" \+ --body "## Summary+ Implements TICKET-123++ ## Changes+ - <list of changes>++ ## Testing+ - <how to test>++ ## JIRA+ [TICKET-123](https://jira.example.com/browse/TICKET-123)" \+ --base main+ ```++ For GitLab:+ ```bash+ glab mr create \+ --title "TICKET-123: <summary>" \+ --description "..." \+ --target-branch main+ ```++8. **Transition the JIRA ticket to In Review**++ First, get available transitions:+ ```+ GET /api/jira/instances/:instanceId/tickets/:ticketKey/transitions+ ```++ Find the transition ID for "In Review", "Code Review", or "Ready for Review" status.++ Then transition:+ ```+ POST /api/jira/instances/:instanceId/tickets/:ticketKey/transition+ Body: { "transitionId": "<transition-id>" }+ ```++9. **Add PR link to JIRA ticket**++ ```+ POST /api/jira/instances/:instanceId/tickets/:ticketKey/comments+ Body: {+ "comment": "Implementation complete. PR: <pr-url>\n\nReady for code review."+ }+ ```++10. **Clean up worktree (optional)**++ The worktree can be kept for reference or cleaned up:+ ```bash+ git worktree remove ../worktrees/TICKET-123+ ```++11. **Generate summary report**+ - Ticket implemented+ - PR created (with link)+ - Ticket transitioned to status+ - Any issues encountered++## Expected Outputs++1. **Code Changes** - Committed to a feature branch+2. **Pull/Merge Request** - Created and linked to ticket+3. **JIRA Ticket Update** - Transitioned to "In Review" with PR link+4. **Summary Report** - Saved via CoS reporting system++## Success Criteria++- One well-defined ticket is selected and implemented per run+- Code is committed to a feature branch (not main/master)+- PR/MR is created with proper description+- JIRA ticket is transitioned to review status+- PR link is added as a JIRA comment+- No broken builds or failing tests introduced++## Job Metadata++- **Category**: jira-ticket-implementation+- **Interval**: Daily+- **Schedule**: Monday-Friday at 9:00 AM (cron: `0 9 * * 1-5`)+- **Priority**: HIGH+- **Autonomy Level**: yolo (fully autonomous implementation)++## Workflow Diagram++```+Start Job+ |+ v+Get JIRA-enabled apps+ |+ v+For each app:+ |+ v+Fetch sprint tickets --> Filter ready tickets --> Select highest priority+ |+ v+Create git worktree+ |+ v+Implement ticket+ |+ v+Commit + Push+ |+ v+Create PR/MR+ |+ v+Transition ticket to "In Review"+ |+ v+Add PR link comment+ |+ v+Generate report+ |+ v+End Job+```++## Example Report Structure++```markdown+# JIRA Ticket Implementation Report - 2026-02-24++## Summary+- Apps checked: 2+- Tickets evaluated: 8+- Ticket implemented: 1+- PR created: Yes++## Implementation Details++### App: MyWebApp (PROJ)++**Selected Ticket:** PROJ-456 (HIGH Priority)+- Summary: Add user profile settings page+- Original Status: To Do+- New Status: In Review++**Implementation:**+- Branch: `feature/PROJ-456`+- Commits: 3+- Files changed: 5+- Lines added: 247+- Lines removed: 12++**Pull Request:**+- URL: https://github.com/org/mywebapp/pull/123+- Title: PROJ-456: Add user profile settings page+- Status: Open, awaiting review++**JIRA Updates:**+- Transitioned to: In Review+- Comment added with PR link++### Skipped Tickets+- PROJ-457: Needs clarification (no acceptance criteria)+- PROJ-458: Already in progress+- PROJ-459: Low priority, well-groomed (deferred)++## Next Steps+1. Monitor PR for review feedback+2. Address any review comments in next run+3. Consider PROJ-457 after requirements clarified+```++## Notes++- This job makes actual code changes and creates PRs+- Only one ticket is implemented per run to maintain quality+- The job respects the app's existing git workflow+- Worktrees ensure the main workspace stays clean+- If implementation fails, the ticket is NOT transitioned+- Failed implementations should be reported but not block future runs+- The job runs Monday-Friday to align with typical work schedulesdiff --git a/server/services/autonomousJobs.js b/server/services/autonomousJobs.jsindex 36850d0a50..7736b576a9 100644--- a/server/services/autonomousJobs.js+++ b/server/services/autonomousJobs.js@@ -37,7 +37,8 @@ const JOB_SKILL_MAP = {'job-project-review': 'project-review','job-moltworld-exploration': 'moltworld-exploration','job-jira-app-maintenance': 'jira-app-maintenance',- 'job-autobiography-prompt': 'autobiography-prompt'+ 'job-autobiography-prompt': 'autobiography-prompt',+ 'job-jira-ticket-implementation': 'jira-ticket-implementation'}// Time constants@@ -254,6 +255,45 @@ This is a lightweight job — it simply checks timing and sends a notification irunCount: 0,createdAt: null,updatedAt: null+ },+ {+ id: 'job-jira-ticket-implementation',+ name: 'JIRA Ticket Implementation',+ description: 'For JIRA-connected apps, pick up the next ready ticket from sprint, implement it in a git worktree, create a merge request, and move the ticket to In Review.',+ category: 'jira-ticket-implementation',+ interval: 'daily',+ intervalMs: DAY,+ scheduledTime: '09:00',+ weekdaysOnly: true,+ enabled: false,+ priority: 'HIGH',+ autonomyLevel: 'yolo',+ promptTemplate: `[Autonomous Job] JIRA Ticket Implementation++You are acting as my Chief of Staff, implementing JIRA tickets for apps with JIRA integration enabled.++This job runs Monday-Friday and focuses on actually implementing tickets, not just reviewing them.++Tasks to perform:+1. Call GET /api/apps to find JIRA-enabled apps+2. For each app with jira.enabled = true and jira.instanceId + jira.projectKey set:+ - Call GET /api/jira/:instanceId/my-sprint-tickets/:projectKey+ - Filter for tickets in "To Do" or "Ready" status that are well-defined+ - Select the highest priority ticket that is ready to implement+3. For the selected ticket:+ - Create a git worktree using the worktree manager+ - Implement the ticket requirements+ - Commit changes and push the branch+ - Create a merge request using gh CLI+ - Transition the ticket to "In Review" status+ - Add a comment to JIRA with the MR link+4. Generate a summary report of work completed++Focus on tickets that are ready to implement. Skip tickets that need clarification.`,+ lastRun: null,+ runCount: 0,+ createdAt: null,+ updatedAt: null}]@@ -372,6 +412,15 @@ function isScheduledTimeMet(scheduledTime) {return nowMinutes >= targetMinutes}+/**+ * Check if today is a weekday (Monday-Friday).+ * @returns {boolean}+ */+function isWeekday() {+ const day = new Date().getDay()+ return day >= 1 && day <= 5+}+/*** Get jobs that are due to run* @returns {Promise<Array>} Due jobs with reason@@ -389,6 +438,9 @@ async function getDueJobs() {// If job has a scheduledTime, only mark due if we've passed that time todayif (!isScheduledTimeMet(job.scheduledTime)) continue+ // If job is weekdaysOnly, skip weekends+ if (job.weekdaysOnly && !isWeekday()) continue+due.push({...job,reason: job.lastRun ? `${job.interval}-due` : 'never-run',@@ -420,6 +472,7 @@ async function createJob(jobData) {interval: jobData.interval || 'weekly',intervalMs: resolveIntervalMs(jobData.interval || 'weekly', jobData.intervalMs),scheduledTime: jobData.scheduledTime || null,+ weekdaysOnly: jobData.weekdaysOnly || false,enabled: jobData.enabled !== undefined ? jobData.enabled : false,priority: jobData.priority || 'MEDIUM',autonomyLevel: jobData.autonomyLevel || 'manager',@@ -452,7 +505,7 @@ async function updateJob(jobId, updates) {const updatableFields = ['name', 'description', 'category', 'interval', 'intervalMs',- 'scheduledTime', 'enabled', 'priority', 'autonomyLevel', 'promptTemplate'+ 'scheduledTime', 'weekdaysOnly', 'enabled', 'priority', 'autonomyLevel', 'promptTemplate']for (const field of updatableFields) {@@ -757,6 +810,7 @@ export {getJobStats,getNextDueJob,isScheduledTimeMet,+ isWeekday,INTERVAL_OPTIONS,loadJobSkillTemplate,saveJobSkillTemplate,