awesome-slash 2.4.4 → 2.5.0

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.
Files changed (144) hide show
  1. package/.claude-plugin/marketplace.json +6 -6
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +88 -1
  4. package/README.md +173 -161
  5. package/SECURITY.md +25 -81
  6. package/adapters/codex/install.sh +58 -16
  7. package/adapters/opencode/install.sh +92 -23
  8. package/lib/index.js +47 -4
  9. package/lib/patterns/review-patterns.js +58 -11
  10. package/lib/patterns/slop-patterns.js +154 -147
  11. package/lib/platform/detect-platform.js +99 -350
  12. package/lib/platform/detection-configs.js +93 -0
  13. package/lib/platform/verify-tools.js +10 -78
  14. package/lib/schemas/README.md +195 -0
  15. package/lib/schemas/validator.js +247 -0
  16. package/lib/sources/custom-handler.js +199 -0
  17. package/lib/sources/policy-questions.js +239 -0
  18. package/lib/sources/source-cache.js +149 -0
  19. package/lib/state/workflow-state.js +363 -665
  20. package/lib/types/README.md +292 -0
  21. package/lib/types/agent-frontmatter.d.ts +134 -0
  22. package/lib/types/command-frontmatter.d.ts +107 -0
  23. package/lib/types/hook-frontmatter.d.ts +115 -0
  24. package/lib/types/index.d.ts +84 -0
  25. package/lib/types/plugin-manifest.d.ts +102 -0
  26. package/lib/types/skill-frontmatter.d.ts +89 -0
  27. package/lib/utils/cache-manager.js +154 -0
  28. package/lib/utils/context-optimizer.js +5 -36
  29. package/lib/utils/deprecation.js +37 -0
  30. package/lib/utils/shell-escape.js +88 -0
  31. package/mcp-server/index.js +513 -18
  32. package/package.json +6 -2
  33. package/plugins/deslop-around/.claude-plugin/plugin.json +1 -1
  34. package/plugins/deslop-around/lib/index.js +170 -0
  35. package/plugins/deslop-around/lib/patterns/review-patterns.js +58 -11
  36. package/plugins/deslop-around/lib/patterns/slop-patterns.js +170 -129
  37. package/plugins/deslop-around/lib/platform/detect-platform.js +212 -123
  38. package/plugins/deslop-around/lib/platform/detection-configs.js +93 -0
  39. package/plugins/deslop-around/lib/platform/verify-tools.js +10 -1
  40. package/plugins/deslop-around/lib/schemas/README.md +195 -0
  41. package/plugins/deslop-around/lib/schemas/validator.js +205 -0
  42. package/plugins/deslop-around/lib/sources/custom-handler.js +199 -0
  43. package/plugins/deslop-around/lib/sources/policy-questions.js +239 -0
  44. package/plugins/deslop-around/lib/sources/source-cache.js +149 -0
  45. package/plugins/deslop-around/lib/state/workflow-state.js +382 -484
  46. package/plugins/deslop-around/lib/types/README.md +292 -0
  47. package/plugins/deslop-around/lib/types/agent-frontmatter.d.ts +134 -0
  48. package/plugins/deslop-around/lib/types/command-frontmatter.d.ts +107 -0
  49. package/plugins/deslop-around/lib/types/hook-frontmatter.d.ts +115 -0
  50. package/plugins/deslop-around/lib/types/index.d.ts +84 -0
  51. package/plugins/deslop-around/lib/types/plugin-manifest.d.ts +102 -0
  52. package/plugins/deslop-around/lib/types/skill-frontmatter.d.ts +89 -0
  53. package/plugins/deslop-around/lib/utils/cache-manager.js +154 -0
  54. package/plugins/deslop-around/lib/utils/context-optimizer.js +115 -37
  55. package/plugins/deslop-around/lib/utils/deprecation.js +37 -0
  56. package/plugins/deslop-around/lib/utils/shell-escape.js +88 -0
  57. package/plugins/next-task/.claude-plugin/plugin.json +1 -1
  58. package/plugins/next-task/agents/delivery-validator.md +2 -2
  59. package/plugins/next-task/agents/implementation-agent.md +3 -4
  60. package/plugins/next-task/agents/planning-agent.md +77 -19
  61. package/plugins/next-task/agents/review-orchestrator.md +21 -122
  62. package/plugins/next-task/agents/task-discoverer.md +164 -23
  63. package/plugins/next-task/commands/next-task.md +180 -14
  64. package/plugins/next-task/lib/index.js +170 -0
  65. package/plugins/next-task/lib/patterns/review-patterns.js +58 -11
  66. package/plugins/next-task/lib/patterns/slop-patterns.js +170 -129
  67. package/plugins/next-task/lib/platform/detect-platform.js +212 -123
  68. package/plugins/next-task/lib/platform/detection-configs.js +93 -0
  69. package/plugins/next-task/lib/platform/verify-tools.js +10 -1
  70. package/plugins/next-task/lib/schemas/README.md +195 -0
  71. package/plugins/next-task/lib/schemas/validator.js +205 -0
  72. package/plugins/next-task/lib/sources/custom-handler.js +199 -0
  73. package/plugins/next-task/lib/sources/policy-questions.js +239 -0
  74. package/plugins/next-task/lib/sources/source-cache.js +149 -0
  75. package/plugins/next-task/lib/state/workflow-state.js +382 -484
  76. package/plugins/next-task/lib/types/README.md +292 -0
  77. package/plugins/next-task/lib/types/agent-frontmatter.d.ts +134 -0
  78. package/plugins/next-task/lib/types/command-frontmatter.d.ts +107 -0
  79. package/plugins/next-task/lib/types/hook-frontmatter.d.ts +115 -0
  80. package/plugins/next-task/lib/types/index.d.ts +84 -0
  81. package/plugins/next-task/lib/types/plugin-manifest.d.ts +102 -0
  82. package/plugins/next-task/lib/types/skill-frontmatter.d.ts +89 -0
  83. package/plugins/next-task/lib/utils/cache-manager.js +154 -0
  84. package/plugins/next-task/lib/utils/context-optimizer.js +115 -37
  85. package/plugins/next-task/lib/utils/deprecation.js +37 -0
  86. package/plugins/next-task/lib/utils/shell-escape.js +88 -0
  87. package/plugins/project-review/.claude-plugin/plugin.json +1 -1
  88. package/plugins/project-review/lib/index.js +170 -0
  89. package/plugins/project-review/lib/patterns/review-patterns.js +58 -11
  90. package/plugins/project-review/lib/patterns/slop-patterns.js +170 -129
  91. package/plugins/project-review/lib/platform/detect-platform.js +212 -123
  92. package/plugins/project-review/lib/platform/detection-configs.js +93 -0
  93. package/plugins/project-review/lib/platform/verify-tools.js +10 -1
  94. package/plugins/project-review/lib/schemas/README.md +195 -0
  95. package/plugins/project-review/lib/schemas/validator.js +205 -0
  96. package/plugins/project-review/lib/sources/custom-handler.js +199 -0
  97. package/plugins/project-review/lib/sources/policy-questions.js +239 -0
  98. package/plugins/project-review/lib/sources/source-cache.js +149 -0
  99. package/plugins/project-review/lib/state/workflow-state.js +382 -484
  100. package/plugins/project-review/lib/types/README.md +292 -0
  101. package/plugins/project-review/lib/types/agent-frontmatter.d.ts +134 -0
  102. package/plugins/project-review/lib/types/command-frontmatter.d.ts +107 -0
  103. package/plugins/project-review/lib/types/hook-frontmatter.d.ts +115 -0
  104. package/plugins/project-review/lib/types/index.d.ts +84 -0
  105. package/plugins/project-review/lib/types/plugin-manifest.d.ts +102 -0
  106. package/plugins/project-review/lib/types/skill-frontmatter.d.ts +89 -0
  107. package/plugins/project-review/lib/utils/cache-manager.js +154 -0
  108. package/plugins/project-review/lib/utils/context-optimizer.js +115 -37
  109. package/plugins/project-review/lib/utils/deprecation.js +37 -0
  110. package/plugins/project-review/lib/utils/shell-escape.js +88 -0
  111. package/plugins/reality-check/.claude-plugin/plugin.json +1 -1
  112. package/plugins/reality-check/agents/code-explorer.md +1 -1
  113. package/plugins/ship/.claude-plugin/plugin.json +1 -1
  114. package/plugins/ship/lib/index.js +170 -0
  115. package/plugins/ship/lib/patterns/review-patterns.js +58 -11
  116. package/plugins/ship/lib/patterns/slop-patterns.js +170 -129
  117. package/plugins/ship/lib/platform/detect-platform.js +212 -123
  118. package/plugins/ship/lib/platform/detection-configs.js +93 -0
  119. package/plugins/ship/lib/platform/verify-tools.js +10 -1
  120. package/plugins/ship/lib/schemas/README.md +195 -0
  121. package/plugins/ship/lib/schemas/validator.js +205 -0
  122. package/plugins/ship/lib/sources/custom-handler.js +199 -0
  123. package/plugins/ship/lib/sources/policy-questions.js +239 -0
  124. package/plugins/ship/lib/sources/source-cache.js +149 -0
  125. package/plugins/ship/lib/state/workflow-state.js +382 -484
  126. package/plugins/ship/lib/types/README.md +292 -0
  127. package/plugins/ship/lib/types/agent-frontmatter.d.ts +134 -0
  128. package/plugins/ship/lib/types/command-frontmatter.d.ts +107 -0
  129. package/plugins/ship/lib/types/hook-frontmatter.d.ts +115 -0
  130. package/plugins/ship/lib/types/index.d.ts +84 -0
  131. package/plugins/ship/lib/types/plugin-manifest.d.ts +102 -0
  132. package/plugins/ship/lib/types/skill-frontmatter.d.ts +89 -0
  133. package/plugins/ship/lib/utils/cache-manager.js +154 -0
  134. package/plugins/ship/lib/utils/context-optimizer.js +115 -37
  135. package/plugins/ship/lib/utils/deprecation.js +37 -0
  136. package/plugins/ship/lib/utils/shell-escape.js +88 -0
  137. package/lib/state/workflow-state.schema.json +0 -282
  138. package/plugins/deslop-around/lib/state/workflow-state.schema.json +0 -282
  139. package/plugins/next-task/agents/policy-selector.md +0 -248
  140. package/plugins/next-task/lib/state/tasks-registry.schema.json +0 -85
  141. package/plugins/next-task/lib/state/workflow-state.schema.json +0 -282
  142. package/plugins/next-task/lib/state/worktree-status.schema.json +0 -219
  143. package/plugins/project-review/lib/state/workflow-state.schema.json +0 -282
  144. package/plugins/ship/lib/state/workflow-state.schema.json +0 -282
@@ -1,12 +1,14 @@
1
1
  ---
2
2
  name: task-discoverer
3
- description: Discover and prioritize tasks from configured sources. Use this agent after policy selection to find the next task to work on.
4
- tools: Bash(gh:*), Bash(git:*), Grep, Read
5
- model: inherit
3
+ description: Discover and prioritize tasks from configured sources. CRITICAL - You MUST use AskUserQuestion tool to present task selection as checkboxes. This agent is invoked after policy selection to find, score, and let the user select the next task to work on via structured checkbox UI.
4
+ tools: Bash(gh:*), Bash(glab:*), Bash(git:*), Grep, Read, AskUserQuestion
5
+ model: sonnet
6
6
  ---
7
7
 
8
8
  # Task Discoverer Agent
9
9
 
10
+ **CRITICAL REQUIREMENT**: You MUST use the AskUserQuestion tool to present task selection as checkboxes to the user. Do NOT present tasks as plain text or ask the user to type a number. The AskUserQuestion tool creates a structured checkbox UI that is required for this agent to function correctly.
11
+
10
12
  You discover tasks from configured sources, validate them against the codebase,
11
13
  and present prioritized recommendations to the user.
12
14
 
@@ -51,35 +53,93 @@ if (claimedTasks.length > 0) {
51
53
 
52
54
  ## Phase 3: Fetch Tasks by Source
53
55
 
56
+ The source configuration comes from policy. It can be:
57
+ - `"github"` or `"gh-issues"` - Use GitHub CLI
58
+ - `"gitlab"` - Use GitLab CLI
59
+ - `"local"` or `"tasks-md"` - Read local markdown files
60
+ - `{ source: "custom", type: "cli", tool: "tea" }` - Custom CLI tool
61
+ - `{ source: "other", description: "..." }` - Agent interprets description
62
+
63
+ ### Parse Source Configuration
64
+
65
+ ```javascript
66
+ const { sources } = require('${CLAUDE_PLUGIN_ROOT}/lib');
67
+
68
+ // Source can be string or object
69
+ const sourceConfig = typeof policy.taskSource === 'string'
70
+ ? { source: policy.taskSource }
71
+ : policy.taskSource;
72
+
73
+ const sourceType = sourceConfig.source || sourceConfig;
74
+ ```
75
+
54
76
  ### GitHub Issues
55
77
 
78
+ **IMPORTANT**: GitHub CLI defaults to 30 issues. For repos with many issues, use `--limit`
79
+ and consider filtering by label to reduce noise. If you hit the limit, iterate with
80
+ pagination or apply stricter label filters.
81
+
56
82
  ```bash
57
- if [ "$TASK_SOURCE" = "gh-issues" ]; then
58
- gh issue list --state open \
59
- --json number,title,body,labels,assignees,createdAt,url \
60
- --limit 100 > /tmp/gh-issues.json
83
+ if [ "$SOURCE_TYPE" = "github" ] || [ "$SOURCE_TYPE" = "gh-issues" ]; then
84
+ # First, get total count to check if pagination needed
85
+ TOTAL_OPEN=$(gh issue list --state open --json number --jq 'length')
86
+ echo "Total open issues: $TOTAL_OPEN"
87
+
88
+ # If many issues exist, filter by priority labels first
89
+ if [ "$TOTAL_OPEN" -gt 100 ]; then
90
+ echo "Large backlog detected. Fetching high-priority issues first..."
91
+
92
+ # Fetch by priority labels (adjust labels to match repo conventions)
93
+ gh issue list --state open \
94
+ --label "priority:high,priority:critical,bug,security" \
95
+ --json number,title,body,labels,assignees,createdAt,url \
96
+ --limit 100 > /tmp/gh-issues.json
97
+
98
+ ISSUE_COUNT=$(cat /tmp/gh-issues.json | jq length)
99
+
100
+ # If still not enough, fetch more without label filter
101
+ if [ "$ISSUE_COUNT" -lt 20 ]; then
102
+ echo "Few priority issues found. Fetching recent issues..."
103
+ gh issue list --state open \
104
+ --json number,title,body,labels,assignees,createdAt,url \
105
+ --limit 100 > /tmp/gh-issues.json
106
+ ISSUE_COUNT=$(cat /tmp/gh-issues.json | jq length)
107
+ fi
108
+ else
109
+ # Small backlog - fetch all
110
+ gh issue list --state open \
111
+ --json number,title,body,labels,assignees,createdAt,url \
112
+ --limit 100 > /tmp/gh-issues.json
113
+ ISSUE_COUNT=$(cat /tmp/gh-issues.json | jq length)
114
+ fi
61
115
 
62
- ISSUE_COUNT=$(cat /tmp/gh-issues.json | jq length)
63
116
  echo "Fetched $ISSUE_COUNT issues from GitHub"
117
+
118
+ # Warn if at limit
119
+ if [ "$ISSUE_COUNT" -eq 100 ]; then
120
+ echo "WARNING: Hit 100 issue limit. Some issues may not be included."
121
+ echo "Consider using priority filter to narrow scope."
122
+ fi
64
123
  fi
65
124
  ```
66
125
 
67
- ### Linear (via GitHub links)
126
+ ### GitLab Issues
68
127
 
69
128
  ```bash
70
- if [ "$TASK_SOURCE" = "linear" ]; then
71
- # Extract Linear IDs from GitHub issue bodies
72
- gh issue list --state open --json body,number,title --limit 50 | \
73
- jq -r '.[] | select(.body | contains("linear.app")) |
74
- {number, title, linearUrl: (.body | capture("https://linear.app/[^\\s]+") | .linearUrl)}' \
75
- > /tmp/linear-tasks.json
129
+ if [ "$SOURCE_TYPE" = "gitlab" ]; then
130
+ glab issue list --state opened \
131
+ --output json \
132
+ --per-page 100 > /tmp/glab-issues.json
133
+
134
+ ISSUE_COUNT=$(cat /tmp/glab-issues.json | jq length)
135
+ echo "Fetched $ISSUE_COUNT issues from GitLab"
76
136
  fi
77
137
  ```
78
138
 
79
- ### PLAN.md / tasks.md
139
+ ### Local tasks.md
80
140
 
81
141
  ```bash
82
- if [ "$TASK_SOURCE" = "tasks-md" ]; then
142
+ if [ "$SOURCE_TYPE" = "local" ] || [ "$SOURCE_TYPE" = "tasks-md" ]; then
83
143
  # Find task files
84
144
  TASK_FILE=""
85
145
  for f in PLAN.md tasks.md TODO.md; do
@@ -98,6 +158,85 @@ if [ "$TASK_SOURCE" = "tasks-md" ]; then
98
158
  fi
99
159
  ```
100
160
 
161
+ ### Custom Source (CLI/MCP/Skill)
162
+
163
+ For custom sources, use cached tool capabilities:
164
+
165
+ ```javascript
166
+ if (sourceConfig.source === 'custom') {
167
+ const toolName = sourceConfig.tool;
168
+ const toolType = sourceConfig.type;
169
+
170
+ // Load cached capabilities
171
+ let capabilities = sources.getToolCapabilities(toolName);
172
+
173
+ // If not cached, probe the tool
174
+ if (!capabilities && toolType === 'cli') {
175
+ capabilities = sources.probeCLI(toolName);
176
+ if (capabilities.available) {
177
+ sources.saveToolCapabilities(toolName, capabilities);
178
+ }
179
+ }
180
+
181
+ if (capabilities?.commands?.list_issues) {
182
+ // Execute the list_issues command
183
+ const cmd = capabilities.commands.list_issues;
184
+ console.log(`Executing: ${cmd}`);
185
+ // Run command and parse output
186
+ } else if (toolType === 'mcp') {
187
+ // Call MCP tool
188
+ console.log(`Calling MCP server: ${toolName}`);
189
+ // MCP call logic
190
+ } else if (toolType === 'skill') {
191
+ // Invoke skill
192
+ console.log(`Invoking skill: ${toolName}`);
193
+ // Skill invocation logic
194
+ } else {
195
+ console.log(`Unknown custom source type: ${toolType}`);
196
+ console.log(`Tool: ${toolName}`);
197
+ console.log(`Attempting generic help: ${toolName} --help`);
198
+ }
199
+ }
200
+ ```
201
+
202
+ ### Other Source (Agent Interprets)
203
+
204
+ For "other" sources, the agent interprets the user's description:
205
+
206
+ ```javascript
207
+ if (sourceConfig.source === 'other') {
208
+ const description = sourceConfig.description;
209
+
210
+ console.log(`User described task source: ${description}`);
211
+ console.log('');
212
+ console.log('Interpreting description to find tasks...');
213
+
214
+ // Agent uses reasoning to figure out how to list tasks
215
+ // Common patterns to try:
216
+ // - "Jira" → check for jira CLI or MCP
217
+ // - "Linear" → check for linear CLI or MCP
218
+ // - "Notion" → check for notion MCP
219
+ // - "file at /path" → read that file
220
+ // - "backlog.md" → read that file
221
+
222
+ // If can't figure it out, ask user for clarification
223
+ if (!tasksFound) {
224
+ AskUserQuestion({
225
+ questions: [{
226
+ header: 'Clarify Source',
227
+ question: `I couldn't automatically find tasks from "${description}". How should I access them?`,
228
+ options: [
229
+ { label: 'CLI Command', description: 'Provide a command to list tasks' },
230
+ { label: 'File Path', description: 'Provide path to task file' },
231
+ { label: 'MCP Server', description: 'Specify MCP server name' }
232
+ ],
233
+ multiSelect: false
234
+ }]
235
+ });
236
+ }
237
+ }
238
+ ```
239
+
101
240
  ## Phase 4: Exclude Claimed Tasks
102
241
 
103
242
  Remove tasks that are already claimed by other workflows:
@@ -249,6 +388,8 @@ Select a task (1-5) or provide a custom task:
249
388
 
250
389
  ## Phase 9: User Selection via AskUserQuestion
251
390
 
391
+ **CRITICAL**: You MUST use AskUserQuestion here - do NOT present tasks as text and ask for typed input.
392
+
252
393
  ```javascript
253
394
  AskUserQuestion({
254
395
  questions: [
@@ -348,10 +489,10 @@ fi
348
489
  - State updated with task details
349
490
  - Phase advanced to worktree-setup
350
491
 
351
- ## Model Choice: Inherit
492
+ ## Model Choice: Sonnet
352
493
 
353
- This agent uses **inherit** because:
354
- - Complexity varies by calling context
355
- - When called from orchestrator (sonnet), inherits sonnet
356
- - Simple task fetching doesn't need opus
357
- - Allows flexibility without over-specifying
494
+ This agent uses **sonnet** because:
495
+ - Needs reasoning for "other" source interpretation
496
+ - Custom source handling requires some intelligence
497
+ - Simple enough that opus would be overkill
498
+ - Fast response for interactive task selection
@@ -8,6 +8,20 @@ allowed-tools: Bash(git:*), Bash(gh:*), Bash(npm:*), Bash(node:*), Read, Write,
8
8
 
9
9
  Discover what to work on next and execute the complete implementation workflow.
10
10
 
11
+ ## Default Behavior (No Arguments)
12
+
13
+ **When you run `/next-task` with NO arguments**:
14
+ 1. Goes to Phase 1: Policy Selection
15
+ 2. Policy selector checks for existing tasks in `.claude/tasks.json`
16
+ 3. If existing tasks found, **ASKS USER** what to do:
17
+ - Start new task (recommended - leaves existing task untouched)
18
+ - Resume existing task
19
+ - Abort existing task
20
+ - View status only
21
+ 4. Then continues with normal policy configuration
22
+
23
+ **CRITICAL**: The workflow NEVER auto-resumes existing tasks. It ALWAYS asks first.
24
+
11
25
  ## Workflow Overview
12
26
 
13
27
  ```
@@ -190,12 +204,55 @@ Parse from $ARGUMENTS:
190
204
  ╚══════════════════════════════════════════════════════════════════════════╝
191
205
  ```
192
206
 
207
+ ## ⛔ CRITICAL: NO AUTO-RESUME GATE
208
+
209
+ ```
210
+ ╔══════════════════════════════════════════════════════════════════════════╗
211
+ ║ ⛔ NO AUTO-RESUME ⛔ ║
212
+ ╠══════════════════════════════════════════════════════════════════════════╣
213
+ ║ ║
214
+ ║ MANDATORY RULE: DO NOT automatically resume existing tasks/worktrees ║
215
+ ║ ║
216
+ ║ ✅ CORRECT BEHAVIOR: ║
217
+ ║ - No arguments → Go to Phase 1 (Policy Selection) ║
218
+ ║ - Policy selector WILL ask about existing tasks ║
219
+ ║ - User explicitly chooses: resume, start fresh, or view status ║
220
+ ║ ║
221
+ ║ ❌ INCORRECT BEHAVIOR (NEVER DO THIS): ║
222
+ ║ - Seeing .claude/tasks.json with existing task → Auto-resume it ║
223
+ ║ - Finding a worktree → Auto-resume it ║
224
+ ║ - Detecting "in_progress" status → Auto-resume it ║
225
+ ║ - Assuming "user wants to continue" → Auto-resume it ║
226
+ ║ ║
227
+ ║ THE ONLY VALID WAYS TO RESUME: ║
228
+ ║ 1. User explicitly passes --resume flag ║
229
+ ║ 2. Policy selector asks and user chooses "Resume" ║
230
+ ║ ║
231
+ ║ EXISTING TASKS ARE USUALLY NOT STALE - THEY MAY BE: ║
232
+ ║ - Running in another terminal/session ║
233
+ ║ - Running by another agent ║
234
+ ║ - Paused for user review ║
235
+ ║ - Waiting for external CI/deployment ║
236
+ ║ ║
237
+ ║ AUTO-RESUMING = CORRUPTING PARALLEL WORKFLOWS ║
238
+ ║ ║
239
+ ╚══════════════════════════════════════════════════════════════════════════╝
240
+ ```
241
+
193
242
  ## Pre-flight: Handle Arguments
194
243
 
195
244
  ```javascript
196
245
  const workflowState = require('${CLAUDE_PLUGIN_ROOT}/lib/state/workflow-state.js');
197
246
  const args = '$ARGUMENTS'.split(' ').filter(Boolean);
198
247
 
248
+ // ⛔ CRITICAL CHECK: If no flags provided, DO NOT check for existing tasks here
249
+ // That check happens in policy-selector, which will ASK the user
250
+ if (args.length === 0 || (!args.includes('--resume') && !args.includes('--status') && !args.includes('--abort'))) {
251
+ console.log("No arguments provided - starting Phase 1 (Policy Selection)");
252
+ console.log("Policy selector will check for existing tasks and ask user what to do.");
253
+ // SKIP to Phase 1 below
254
+ }
255
+
199
256
  // Handle --status
200
257
  if (args.includes('--status')) {
201
258
  const summary = workflowState.getWorkflowSummary();
@@ -294,31 +351,70 @@ function mapStepToPhase(step) {
294
351
  }
295
352
  ```
296
353
 
297
- ## Phase 1: Policy Selection
354
+ ## Phase 1: Policy Selection (Direct Questions)
298
355
 
299
- **Agent**: `next-task:policy-selector` (haiku)
356
+ No agent needed - call `sources.getPolicyQuestions()` and use AskUserQuestion.
300
357
 
301
358
  ```javascript
302
- workflowState.startPhase('policy-selection');
359
+ const { sources } = require('${CLAUDE_PLUGIN_ROOT}/lib');
303
360
 
304
- await Task({
305
- subagent_type: "next-task:policy-selector",
306
- prompt: `Configure workflow via checkbox selection. Gather: task source, priority filter, stopping point.`
361
+ // Get questions with cache-aware options (cached preference shown first if exists)
362
+ const { questions, cachedPreference } = sources.getPolicyQuestions();
363
+
364
+ // Ask all 3 questions at once
365
+ AskUserQuestion({ questions });
366
+
367
+ // After user responds, check if follow-up needed
368
+ if (sources.needsCustomFollowUp(sourceAnswer)) {
369
+ // Custom: ask type (CLI/MCP/Skill/File)
370
+ AskUserQuestion(sources.getCustomTypeQuestions());
371
+
372
+ // Then ask for name/path
373
+ const typeInternal = sources.mapTypeSelection(typeAnswer);
374
+ AskUserQuestion(sources.getCustomNameQuestion(typeInternal));
375
+ }
376
+
377
+ if (sources.needsOtherDescription(sourceAnswer)) {
378
+ // Other: user types free description (via "Other" option in AskUserQuestion)
379
+ }
380
+
381
+ // Parse responses and cache preference
382
+ const policy = sources.parseAndCachePolicy({
383
+ source: sourceAnswer,
384
+ priority: priorityAnswer,
385
+ stopPoint: stopPointAnswer,
386
+ custom: { type: typeAnswer, name: nameAnswer, description: otherDescription }
307
387
  });
308
388
 
309
- // Policy now in state
389
+ workflowState.updateFlow({ policy, phase: 'task-discovery', status: 'in_progress' });
310
390
  ```
311
391
 
392
+ **What the lib function handles:**
393
+ - Reads cache from `.claude/sources/preference.json`
394
+ - If cached, shows it as first option with "(last used)" label
395
+ - Returns ready-to-use AskUserQuestion structure
396
+ - `parseAndCachePolicy()` saves preference for next time
397
+
312
398
  ## Phase 2: Task Discovery
313
399
 
314
- → **Agent**: `next-task:task-discoverer` (inherit)
400
+ → **Agent**: `next-task:task-discoverer` (sonnet)
401
+
402
+ The task-discoverer receives the source configuration from policy and handles:
403
+ - **github**: Uses `gh issue list`
404
+ - **gitlab**: Uses `glab issue list`
405
+ - **local**: Reads `tasks.md`, `PLAN.md`, or `TODO.md`
406
+ - **custom**: Uses cached tool capabilities (e.g., `tea issues list` for Gitea)
407
+ - **other**: Agent interprets user's description and figures out how to list tasks
315
408
 
316
409
  ```javascript
317
410
  workflowState.startPhase('task-discovery');
318
411
 
412
+ // Pass full source config to task-discoverer
413
+ const sourceConfig = policy.taskSource;
414
+
319
415
  await Task({
320
416
  subagent_type: "next-task:task-discoverer",
321
- prompt: `Discover tasks from ${policy.taskSource}, filter by ${policy.priorityFilter}. Present top 5 to user for selection.`
417
+ prompt: `Discover tasks from source: ${JSON.stringify(sourceConfig)}. Filter by: ${policy.priorityFilter}. Present top 5 to user for selection.`
322
418
  });
323
419
 
324
420
  // Selected task now in state.task
@@ -362,20 +458,90 @@ await Task({
362
458
  ```javascript
363
459
  workflowState.startPhase('planning');
364
460
 
365
- await Task({
461
+ const planOutput = await Task({
366
462
  subagent_type: "next-task:planning-agent",
367
463
  model: "opus",
368
- prompt: `Design implementation plan for task #${state.task.id}. Enter plan mode for user approval.`
464
+ prompt: `Design implementation plan for task #${state.task.id}. Output structured JSON plan between === PLAN_START === and === PLAN_END === markers.`
369
465
  });
370
466
 
371
- // Agent uses EnterPlanMode user approves → ExitPlanMode
467
+ // Parse the plan from agent output
468
+ const planMatch = planOutput.match(/=== PLAN_START ===([\s\S]*?)=== PLAN_END ===/);
469
+ if (!planMatch) {
470
+ console.error("ERROR: Planning agent did not output structured plan");
471
+ return;
472
+ }
473
+
474
+ const plan = JSON.parse(planMatch[1].trim());
475
+ console.log(`✓ Plan received: ${plan.steps.length} steps, ${plan.complexity.overall} complexity`);
372
476
  ```
373
477
 
374
- ## Phase 6: User Approval
478
+ ## Phase 6: User Approval (Plan Mode)
375
479
 
376
- Planning agent handles this via EnterPlanMode/ExitPlanMode.
377
480
  **This is the LAST human interaction point.**
378
481
 
482
+ The orchestrator enters plan mode and presents the structured plan:
483
+
484
+ ```javascript
485
+ // Convert plan to markdown for presentation
486
+ const planMarkdown = `# Implementation Plan: ${plan.task.title}
487
+
488
+ ## Overview
489
+ ${plan.overview}
490
+
491
+ ## Architecture Decision
492
+ ${plan.architecture}
493
+
494
+ ${plan.steps.map((step, i) => `
495
+ ## Step ${i + 1}: ${step.title}
496
+
497
+ **Goal**: ${step.goal}
498
+
499
+ **Files to modify**:
500
+ ${step.files.map(f => `- \`${f.path}\` - ${f.changes}`).join('\n')}
501
+
502
+ **Implementation**:
503
+ ${step.details.map(d => `- ${d}`).join('\n')}
504
+
505
+ ${step.risks?.length ? `**Risks**: ${step.risks.join(', ')}` : ''}
506
+ `).join('\n')}
507
+
508
+ ## Critical Paths
509
+
510
+ **High Risk**: ${plan.critical.highRisk.join(', ') || 'None'}
511
+ **Needs Review**: ${plan.critical.needsReview.join(', ') || 'None'}
512
+ ${plan.critical.performance?.length ? `**Performance**: ${plan.critical.performance.join(', ')}` : ''}
513
+ ${plan.critical.security?.length ? `**Security**: ${plan.critical.security.join(', ')}` : ''}
514
+
515
+ ## Complexity Assessment
516
+
517
+ **Overall**: ${plan.complexity.overall}
518
+ **Confidence**: ${plan.complexity.confidence}
519
+ **Reasoning**: ${plan.complexity.reasoning}
520
+ `;
521
+
522
+ console.log("✓ Entering plan mode for user approval...");
523
+
524
+ // Enter plan mode with the formatted plan
525
+ EnterPlanMode();
526
+
527
+ // When we reach here, user has approved via ExitPlanMode
528
+ console.log("✓ Plan approved by user");
529
+ console.log("✓ Proceeding to implementation...");
530
+
531
+ // Save approved plan to state
532
+ workflowState.completePhase({
533
+ planApproved: true,
534
+ plan: plan,
535
+ approvedAt: new Date().toISOString()
536
+ });
537
+ ```
538
+
539
+ **What happens in plan mode**:
540
+ 1. User sees the formatted plan
541
+ 2. User reviews and can request changes
542
+ 3. User approves via ExitPlanMode
543
+ 4. Control returns here to Phase 7 (Implementation)
544
+
379
545
  ## Phase 7: Implementation
380
546
 
381
547
  → **Agent**: `next-task:implementation-agent` (opus)
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Awesome-Slash Core Library
3
+ *
4
+ * Unified entry point for all core library modules.
5
+ * Provides platform detection, pattern matching, workflow state management,
6
+ * configuration management, and context optimization utilities.
7
+ *
8
+ * @module awesome-slash/lib
9
+ * @author Avi Fenesh
10
+ * @license MIT
11
+ */
12
+
13
+ const detectPlatform = require('./platform/detect-platform');
14
+ const verifyTools = require('./platform/verify-tools');
15
+ const reviewPatterns = require('./patterns/review-patterns');
16
+ const slopPatterns = require('./patterns/slop-patterns');
17
+ const workflowState = require('./state/workflow-state');
18
+ const contextOptimizer = require('./utils/context-optimizer');
19
+ const shellEscape = require('./utils/shell-escape');
20
+ const config = require('./config');
21
+ const sourceCache = require('./sources/source-cache');
22
+ const customHandler = require('./sources/custom-handler');
23
+ const policyQuestions = require('./sources/policy-questions');
24
+
25
+ /**
26
+ * Platform detection and verification utilities
27
+ */
28
+ const platform = {
29
+ /**
30
+ * Detect project platform configuration
31
+ * @see module:platform/detect-platform
32
+ */
33
+ detect: detectPlatform.detect,
34
+ detectAsync: detectPlatform.detectAsync,
35
+ detectCI: detectPlatform.detectCI,
36
+ detectDeployment: detectPlatform.detectDeployment,
37
+ detectProjectType: detectPlatform.detectProjectType,
38
+ detectPackageManager: detectPlatform.detectPackageManager,
39
+ detectBranchStrategy: detectPlatform.detectBranchStrategy,
40
+ detectMainBranch: detectPlatform.detectMainBranch,
41
+ invalidateCache: detectPlatform.invalidateCache,
42
+
43
+ /**
44
+ * Verify tool availability
45
+ * @see module:platform/verify-tools
46
+ */
47
+ verifyTools: verifyTools.verify,
48
+ verifyToolsAsync: verifyTools.verifyAsync,
49
+ checkTool: verifyTools.checkTool,
50
+ checkToolAsync: verifyTools.checkToolAsync,
51
+ TOOL_DEFINITIONS: verifyTools.TOOL_DEFINITIONS
52
+ };
53
+
54
+ /**
55
+ * Code pattern matching utilities
56
+ */
57
+ const patterns = {
58
+ /**
59
+ * Review patterns for code quality analysis
60
+ * @see module:patterns/review-patterns
61
+ */
62
+ review: reviewPatterns,
63
+
64
+ /**
65
+ * Slop patterns for AI-generated code detection
66
+ * @see module:patterns/slop-patterns
67
+ */
68
+ slop: slopPatterns
69
+ };
70
+
71
+ /**
72
+ * Workflow state management
73
+ * @see module:state/workflow-state
74
+ */
75
+ const state = {
76
+ // Constants
77
+ SCHEMA_VERSION: workflowState.SCHEMA_VERSION,
78
+ PHASES: workflowState.PHASES,
79
+ DEFAULT_POLICY: workflowState.DEFAULT_POLICY,
80
+
81
+ // Core functions
82
+ generateWorkflowId: workflowState.generateWorkflowId,
83
+ getStatePath: workflowState.getStatePath,
84
+ ensureStateDir: workflowState.ensureStateDir,
85
+ validateStateSchema: workflowState.validateStateSchema,
86
+
87
+ // CRUD operations
88
+ createState: workflowState.createState,
89
+ readState: workflowState.readState,
90
+ writeState: workflowState.writeState,
91
+ updateState: workflowState.updateState,
92
+ deleteState: workflowState.deleteState,
93
+
94
+ // Phase management
95
+ startPhase: workflowState.startPhase,
96
+ completePhase: workflowState.completePhase,
97
+ failPhase: workflowState.failPhase,
98
+ skipToPhase: workflowState.skipToPhase,
99
+
100
+ // Workflow lifecycle
101
+ completeWorkflow: workflowState.completeWorkflow,
102
+ abortWorkflow: workflowState.abortWorkflow,
103
+ hasActiveWorkflow: workflowState.hasActiveWorkflow,
104
+ getWorkflowSummary: workflowState.getWorkflowSummary,
105
+
106
+ // Agent management
107
+ updateAgentResult: workflowState.updateAgentResult,
108
+ incrementIteration: workflowState.incrementIteration
109
+ };
110
+
111
+ /**
112
+ * Git command optimization and string escaping utilities
113
+ * @see module:utils/context-optimizer
114
+ * @see module:utils/shell-escape
115
+ */
116
+ const utils = {
117
+ contextOptimizer,
118
+ shellEscape
119
+ };
120
+
121
+ /**
122
+ * Task source management
123
+ * @see module:sources/source-cache
124
+ * @see module:sources/custom-handler
125
+ * @see module:sources/policy-questions
126
+ */
127
+ const sources = {
128
+ // Main entry point - returns ready-to-use question structure
129
+ getPolicyQuestions: policyQuestions.getPolicyQuestions,
130
+ getCustomTypeQuestions: policyQuestions.getCustomTypeQuestions,
131
+ getCustomNameQuestion: policyQuestions.getCustomNameQuestion,
132
+ parseAndCachePolicy: policyQuestions.parseAndCachePolicy,
133
+ isUsingCached: policyQuestions.isUsingCached,
134
+ needsCustomFollowUp: policyQuestions.needsCustomFollowUp,
135
+ needsOtherDescription: policyQuestions.needsOtherDescription,
136
+
137
+ // Cache operations (direct access if needed)
138
+ getPreference: sourceCache.getPreference,
139
+ savePreference: sourceCache.savePreference,
140
+ getToolCapabilities: sourceCache.getToolCapabilities,
141
+ saveToolCapabilities: sourceCache.saveToolCapabilities,
142
+ clearCache: sourceCache.clearCache,
143
+
144
+ // Custom source handling (direct access if needed)
145
+ SOURCE_TYPES: customHandler.SOURCE_TYPES,
146
+ probeCLI: customHandler.probeCLI,
147
+ buildCustomConfig: customHandler.buildCustomConfig
148
+ };
149
+
150
+ // Main exports
151
+ module.exports = {
152
+ platform,
153
+ patterns,
154
+ state,
155
+ utils,
156
+ config,
157
+ sources,
158
+
159
+ // Direct module access for backward compatibility
160
+ detectPlatform,
161
+ verifyTools,
162
+ reviewPatterns,
163
+ slopPatterns,
164
+ workflowState,
165
+ contextOptimizer,
166
+ shellEscape,
167
+ sourceCache,
168
+ customHandler,
169
+ policyQuestions
170
+ };