@kjerneverk/riotplan 1.0.7-dev.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.
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2025 Tim O'Brien
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,211 @@
1
+ # MCP Elicitation Notes
2
+
3
+ ## Understanding MCP Elicitation
4
+
5
+ ### What It Is
6
+
7
+ MCP elicitation (introduced in the 2025-06-18 specification) is a protocol feature that allows **servers** to request structured data from users dynamically during interactions. It uses JSON schemas to validate responses and enables interactive workflows.
8
+
9
+ ### How It Works
10
+
11
+ Servers send `elicitation/create` requests to clients:
12
+
13
+ ```json
14
+ {
15
+ "jsonrpc": "2.0",
16
+ "id": 1,
17
+ "method": "elicitation/create",
18
+ "params": {
19
+ "message": "Please provide your GitHub username",
20
+ "requestedSchema": {
21
+ "type": "object",
22
+ "properties": {
23
+ "name": { "type": "string" }
24
+ },
25
+ "required": ["name"]
26
+ }
27
+ }
28
+ }
29
+ ```
30
+
31
+ Clients respond with:
32
+
33
+ ```json
34
+ {
35
+ "jsonrpc": "2.0",
36
+ "id": 1,
37
+ "result": {
38
+ "action": "accept",
39
+ "content": { "name": "octocat" }
40
+ }
41
+ }
42
+ ```
43
+
44
+ ### Key Limitation for Prompts
45
+
46
+ **Prompts cannot directly trigger elicitation requests.** Prompts are static text templates that return messages to inject into the conversation. They don't have the ability to make protocol-level requests.
47
+
48
+ Only **tools** and **resources** can trigger elicitation by making `elicitation/create` requests during their execution.
49
+
50
+ ## Our Approach: Prompt Arguments + Model Instructions
51
+
52
+ Since prompts can't trigger elicitation directly, we use a hybrid approach:
53
+
54
+ ### 1. Define Prompt Arguments
55
+
56
+ ```typescript
57
+ {
58
+ name: 'create_plan',
59
+ description: 'Create a new plan with AI-generated steps for a complex task',
60
+ arguments: [
61
+ {
62
+ name: 'code',
63
+ description: 'Plan code/identifier',
64
+ required: false,
65
+ },
66
+ {
67
+ name: 'description',
68
+ description: 'Detailed description of what to accomplish',
69
+ required: false,
70
+ },
71
+ {
72
+ name: 'directory',
73
+ description: 'Parent directory where the plan should be created',
74
+ required: false,
75
+ },
76
+ ],
77
+ }
78
+ ```
79
+
80
+ ### 2. Template Variable Substitution
81
+
82
+ The prompt template uses `${code}`, `${description}`, etc.:
83
+
84
+ ```markdown
85
+ ## Step 1: Review Provided Information
86
+
87
+ Check what information has already been provided:
88
+ - **code**: ${code}
89
+ - **description**: ${description}
90
+ - **directory**: ${directory}
91
+ ```
92
+
93
+ When arguments are missing, we substitute with markers like `[code]`, `[description]`:
94
+
95
+ ```typescript
96
+ if (!filledArgs.code) filledArgs.code = '[code]';
97
+ if (!filledArgs.description) filledArgs.description = '[description]';
98
+ ```
99
+
100
+ ### 3. Model Instructions
101
+
102
+ The prompt explicitly tells the model to check for these markers:
103
+
104
+ ```markdown
105
+ ## Step 2: Gather Missing Information
106
+
107
+ For any information marked as "[code]", "[description]", "[directory]",
108
+ ask the user to provide it:
109
+
110
+ 1. **Plan Code** (if missing) - Ask for a short identifier
111
+ 2. **Plan Description** (if missing) - Ask for a detailed description
112
+ 3. **Target Directory** (if missing) - Ask where to create the plan
113
+ ```
114
+
115
+ ## Benefits of This Approach
116
+
117
+ ### Client-Side Elicitation (Future)
118
+
119
+ MCP clients could potentially:
120
+ 1. See that `create_plan` has arguments
121
+ 2. Elicit those arguments from the user BEFORE invoking the prompt
122
+ 3. Pass the collected values when calling the prompt
123
+
124
+ This would provide a form-based UI for gathering information upfront.
125
+
126
+ ### Model-Side Fallback (Current)
127
+
128
+ If the client doesn't elicit arguments:
129
+ 1. The prompt is invoked with missing arguments
130
+ 2. Template substitution marks them as `[code]`, `[description]`, etc.
131
+ 3. The model sees these markers and knows to ask the user
132
+ 4. The model uses natural language to gather information
133
+
134
+ ### Progressive Enhancement
135
+
136
+ - Works today with explicit model instructions
137
+ - Can be enhanced in the future if clients add argument elicitation
138
+ - Provides clear structure for what information is needed
139
+
140
+ ## Alternative: Tool-Based Elicitation
141
+
142
+ Another approach would be to create a tool that triggers elicitation:
143
+
144
+ ```typescript
145
+ {
146
+ name: 'riotplan_elicit_plan_info',
147
+ description: 'Gather plan information from user',
148
+ inputSchema: {
149
+ type: 'object',
150
+ properties: {}
151
+ }
152
+ }
153
+
154
+ async function executeElicitPlanInfo(args, context) {
155
+ // Make elicitation/create request
156
+ const result = await context.elicit({
157
+ message: "Please provide plan information",
158
+ requestedSchema: {
159
+ type: "object",
160
+ properties: {
161
+ code: { type: "string", description: "Plan code" },
162
+ description: { type: "string", description: "What to accomplish" },
163
+ directory: { type: "string", description: "Where to create plan" }
164
+ },
165
+ required: ["code", "description"]
166
+ }
167
+ });
168
+
169
+ return result;
170
+ }
171
+ ```
172
+
173
+ However, this has drawbacks:
174
+ - Requires the model to know to call this tool
175
+ - Adds an extra step (call tool, then call create)
176
+ - Less integrated with the prompt workflow
177
+
178
+ ## Recommendation
179
+
180
+ The **prompt arguments + model instructions** approach is the best solution because:
181
+
182
+ 1. **Works today** - Model instructions ensure it works immediately
183
+ 2. **Future-proof** - Can be enhanced if clients add argument elicitation
184
+ 3. **Clear structure** - Arguments document what's needed
185
+ 4. **Flexible** - Users can provide info upfront OR be prompted
186
+ 5. **Natural** - Model asks in conversational way, not just forms
187
+
188
+ ## Implementation Status
189
+
190
+ ✅ Added prompt arguments to `create_plan`
191
+ ✅ Added template variable substitution
192
+ ✅ Added explicit model instructions
193
+ ✅ Rebuilt MCP server with changes
194
+ ⏳ Waiting for client support for argument elicitation (future enhancement)
195
+
196
+ ## Testing
197
+
198
+ To test the current implementation:
199
+
200
+ 1. Invoke `create_plan` prompt without arguments
201
+ 2. Model should see `[code]`, `[description]`, `[directory]` markers
202
+ 3. Model should ask user for missing information
203
+ 4. Model should use `riotplan_create` tool with collected info
204
+
205
+ To test future client elicitation (when supported):
206
+
207
+ 1. Client sees `create_plan` has arguments
208
+ 2. Client shows form to collect: code, description, directory
209
+ 3. Client invokes prompt with collected values
210
+ 4. Model sees actual values, not markers
211
+ 5. Model proceeds directly to creating the plan
@@ -0,0 +1,122 @@
1
+ # Fix: explore_idea Command UX Issue
2
+
3
+ ## Problem
4
+
5
+ The `explore_idea` MCP prompt had a workflow mismatch that created a confusing user experience:
6
+
7
+ 1. User invokes the prompt (via MCP or Cursor command)
8
+ 2. AI would immediately stop and ask for structured input:
9
+ - "Please provide a code/identifier"
10
+ - "Please provide an initial description"
11
+ 3. User had to provide these in a second interaction
12
+ 4. Only then would the AI create the idea and begin exploration
13
+
14
+ This created a jarring, form-filling experience instead of a natural conversational flow.
15
+
16
+ ## Root Cause
17
+
18
+ The MCP prompt file (`src/mcp/prompts/explore_idea.md`) had outdated instructions that told the AI to:
19
+ 1. Ask the user for code and description
20
+ 2. Wait for response
21
+ 3. Then create the idea
22
+
23
+ Meanwhile, the Cursor command version (`.cursor/commands/explore_idea.md`) had already been updated with smart extraction logic.
24
+
25
+ ## Solution
26
+
27
+ Updated the MCP prompt to match the improved Cursor command version with smart extraction:
28
+
29
+ ### Key Changes
30
+
31
+ 1. **Smart Extraction First**: AI now checks if the user already provided code/description in their message
32
+ 2. **Derive Missing Info**: If description is provided but code is missing, AI derives a kebab-case code from the description
33
+ 3. **Natural Fallback**: Only asks for missing information if truly needed
34
+ 4. **Immediate Creation**: Creates the idea as soon as it has the required info
35
+ 5. **Start Exploration**: Begins the exploration conversation immediately after creation
36
+
37
+ ### Updated Workflow
38
+
39
+ ```
40
+ 1. Extract or Gather Idea Details
41
+ - Check user's message for code and description
42
+ - Extract if present
43
+ - Derive code from description if only description provided
44
+ - Only ask if both are missing
45
+
46
+ 2. Create the Idea
47
+ - Call riotplan_idea_create immediately with extracted/derived values
48
+
49
+ 3. Begin Exploration
50
+ - Start asking open-ended questions immediately
51
+ - Don't wait for further prompting
52
+ ```
53
+
54
+ ### Example Flows
55
+
56
+ **Before Fix:**
57
+ ```
58
+ User: /riotplan/explore_idea
59
+ AI: "Please provide: 1. A short code/identifier 2. Initial description"
60
+ User: "Ugh, okay... code is 'my-feature', description is 'Add feature X'"
61
+ AI: *calls riotplan_idea_create*
62
+ AI: "What's driving this?"
63
+ ```
64
+
65
+ **After Fix - Full Info:**
66
+ ```
67
+ User: /riotplan/explore_idea real-time-notifications Add push notifications
68
+ AI: *extracts code="real-time-notifications", description="Add push notifications"*
69
+ AI: *calls riotplan_idea_create immediately*
70
+ AI: "Let's explore this idea. What's driving the need for push notifications?"
71
+ ```
72
+
73
+ **After Fix - Partial Info:**
74
+ ```
75
+ User: /riotplan/explore_idea I want to add notifications
76
+ AI: *derives code="add-notifications", description="I want to add notifications"*
77
+ AI: *calls riotplan_idea_create immediately*
78
+ AI: "Let's explore this notification idea. What's driving this?"
79
+ ```
80
+
81
+ **After Fix - No Info:**
82
+ ```
83
+ User: /riotplan/explore_idea
84
+ AI: "What idea would you like to explore? Give me a short name and brief description."
85
+ User: "I'm thinking about real-time notifications"
86
+ AI: *extracts and creates immediately*
87
+ AI: "Great! Let's explore this. What's driving the need?"
88
+ ```
89
+
90
+ ## Files Changed
91
+
92
+ - `/Users/tobrien/gitw/kjerneverk/riotplan/src/mcp/prompts/explore_idea.md`
93
+ - Updated workflow section with smart extraction logic
94
+ - Added detailed examples showing extraction patterns
95
+ - Added anti-pattern: "Don't ask for information the user already provided"
96
+ - Added principle: "Smart Extraction: Use information the user already provided"
97
+
98
+ ## Testing
99
+
100
+ - All existing tests pass (623 tests, 92.84% coverage)
101
+ - No breaking changes to MCP tool schemas
102
+ - Backward compatible with all existing workflows
103
+
104
+ ## Benefits
105
+
106
+ 1. **Better UX**: Natural conversational flow instead of form-filling
107
+ 2. **Fewer Steps**: Reduces interaction from 2-3 messages to 1
108
+ 3. **Smarter AI**: AI extracts and derives information intelligently
109
+ 4. **Consistent**: MCP prompt now matches Cursor command behavior
110
+ 5. **Flexible**: Still supports all three scenarios (full info, partial info, no info)
111
+
112
+ ## Related Work
113
+
114
+ The Cursor command version (`.cursor/commands/explore_idea.md`) already had this smart extraction logic. This fix brings the MCP prompt in sync with that improved version.
115
+
116
+ ## Future Considerations
117
+
118
+ This pattern could be applied to other interactive prompts/commands that currently ask for structured input upfront. Candidates to review:
119
+ - `checkpoint_create` (asks for name and message)
120
+ - Any other prompts that immediately request structured data
121
+
122
+ The key insight: **Extract first, ask later**. If the user has already provided information in their message, use it instead of asking them to repeat it.
package/MCP-FIXES.md ADDED
@@ -0,0 +1,50 @@
1
+ # MCP Implementation Fixes Needed
2
+
3
+ ## TypeScript Errors to Fix
4
+
5
+ ### 1. Plan.path -> Plan.metadata.path
6
+ - Plan type doesn't have `path` property
7
+ - Use `plan.metadata.path` instead
8
+
9
+ ### 2. PlanStep.file -> PlanStep.filename
10
+ - PlanStep has `filename` not `file`
11
+
12
+ ### 3. PlanState property names
13
+ - `lastCompleted` -> `lastCompletedStep`
14
+ - `lastUpdated` -> `lastUpdatedAt`
15
+
16
+ ### 4. PlanMetadata property names
17
+ - `created` -> `createdAt`
18
+
19
+ ### 5. Blocker[] and Issue[] types
20
+ - StatusResource expects `string[]` but Plan has `Blocker[]` and `Issue[]`
21
+ - Need to convert to strings or update types
22
+
23
+ ### 6. ValidateOptions
24
+ - `fix` property doesn't exist
25
+ - Need to check actual API
26
+
27
+ ### 7. CreatePlanResult
28
+ - Doesn't have `steps` property
29
+ - Check actual return type
30
+
31
+ ### 8. GenerationContext
32
+ - Missing `planName` property
33
+ - Need to provide it
34
+
35
+ ### 9. MCP Build Externals
36
+ - Need to add execution provider packages to externals in build-mcp.js
37
+
38
+ ## Files to Update
39
+
40
+ 1. `src/mcp/resources/plan.ts` - Fix property names
41
+ 2. `src/mcp/resources/status.ts` - Fix property names and types
42
+ 3. `src/mcp/resources/step.ts` - Fix property names
43
+ 4. `src/mcp/resources/steps.ts` - Fix property names
44
+ 5. `src/mcp/tools/status.ts` - Fix property names
45
+ 6. `src/mcp/tools/step.ts` - Fix property names
46
+ 7. `src/mcp/tools/create.ts` - Fix return type handling
47
+ 8. `src/mcp/tools/generate.ts` - Fix GenerationContext
48
+ 9. `src/mcp/tools/validate.ts` - Fix options
49
+ 10. `src/mcp/types.ts` - Update StatusResource type
50
+ 11. `scripts/build-mcp.js` - Add externals