@benzotti/jedi 0.1.26 → 0.1.28

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.
@@ -47,9 +47,20 @@ jobs:
47
47
  && contains(github.event.comment.body, 'Hey Jedi')
48
48
  runs-on: ubuntu-latest
49
49
  steps:
50
+ # Resolve the PR head branch for issue_comment events
51
+ # (github.head_ref is only set on pull_request events, not issue_comment)
52
+ - name: Resolve PR branch
53
+ id: pr
54
+ if: github.event.issue.pull_request
55
+ run: |
56
+ PR_DATA=$(gh api repos/${{ github.repository }}/pulls/${{ github.event.issue.number }} --jq '{head_ref: .head.ref, head_sha: .head.sha}')
57
+ echo "branch=$(echo "$PR_DATA" | jq -r .head_ref)" >> "$GITHUB_OUTPUT"
58
+ env:
59
+ GH_TOKEN: ${{ github.token }}
60
+
50
61
  - uses: actions/checkout@v4
51
62
  with:
52
- ref: ${{ github.head_ref || github.ref }}
63
+ ref: ${{ steps.pr.outputs.branch || github.head_ref || github.ref }}
53
64
 
54
65
  # Restore persisted Jedi state (learnings + codebase-index)
55
66
  # 1. Exact match for this branch
@@ -63,7 +74,7 @@ jobs:
63
74
  .jdi/framework/
64
75
  .jdi/config/
65
76
  .claude/
66
- key: jedi-state-${{ github.repository }}-${{ github.head_ref || github.ref_name }}
77
+ key: jedi-state-${{ github.repository }}-${{ steps.pr.outputs.branch || github.head_ref || github.ref_name }}
67
78
  restore-keys: |
68
79
  jedi-state-${{ github.repository }}-main
69
80
 
@@ -107,20 +118,22 @@ jobs:
107
118
  run: bun install -g @anthropic-ai/claude-code
108
119
 
109
120
  # Run Jedi CLI directly — full pipeline with routing, agents, and comment posting
121
+ # IMPORTANT: Comment body is passed via env var to avoid shell injection
122
+ # (backticks, $(), etc. in comments would be executed as commands if interpolated inline)
110
123
  - name: Run Jedi
111
124
  run: |
112
- COMMENT_BODY="${{ github.event.comment.body }}"
113
- COMMENT_ID="${{ github.event.comment.id }}"
114
- PR_NUMBER="${{ github.event.issue.pull_request && github.event.issue.number || '' }}"
115
- ISSUE_NUMBER="${{ github.event.issue.number }}"
116
-
117
- ARGS="--repo ${{ github.repository }}"
125
+ ARGS="--repo $REPO"
118
126
  [ -n "$COMMENT_ID" ] && ARGS="$ARGS --comment-id $COMMENT_ID"
119
127
  [ -n "$PR_NUMBER" ] && ARGS="$ARGS --pr-number $PR_NUMBER"
120
128
  [ -n "$ISSUE_NUMBER" ] && ARGS="$ARGS --issue-number $ISSUE_NUMBER"
121
129
 
122
130
  bunx @benzotti/jedi@latest action "$COMMENT_BODY" $ARGS
123
131
  env:
132
+ COMMENT_BODY: ${{ github.event.comment.body }}
133
+ COMMENT_ID: ${{ github.event.comment.id }}
134
+ PR_NUMBER: ${{ github.event.issue.pull_request && github.event.issue.number || '' }}
135
+ ISSUE_NUMBER: ${{ github.event.issue.number }}
136
+ REPO: ${{ github.repository }}
124
137
  ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
125
138
  CLICKUP_API_TOKEN: ${{ secrets.CLICKUP_API_TOKEN }}
126
139
  GH_TOKEN: ${{ github.token }}
@@ -135,7 +148,7 @@ jobs:
135
148
  .jdi/framework/
136
149
  .jdi/config/
137
150
  .claude/
138
- key: jedi-state-${{ github.repository }}-${{ github.head_ref || github.ref_name }}-${{ github.run_id }}
151
+ key: jedi-state-${{ github.repository }}-${{ steps.pr.outputs.branch || github.head_ref || github.ref_name }}-${{ github.run_id }}
139
152
 
140
153
  # ── Promote learnings to main baseline when PRs merge ──
141
154
  promote-learnings:
package/dist/index.js CHANGED
@@ -11169,8 +11169,9 @@ function buildConversationContext(thread, currentCommentId) {
11169
11169
  }
11170
11170
  const previousJediRuns = jediSegments.filter((c3) => c3.isJedi).length;
11171
11171
  const isFollowUp = previousJediRuns > 0;
11172
+ const isPostImplementation = jediSegments.some((c3) => c3.isJedi && c3.body.includes("<sup>implement</sup>"));
11172
11173
  if (jediSegments.length === 0) {
11173
- return { history: "", previousJediRuns: 0, isFollowUp: false };
11174
+ return { history: "", previousJediRuns: 0, isFollowUp: false, isPostImplementation: false };
11174
11175
  }
11175
11176
  const lines = ["## Previous Conversation", ""];
11176
11177
  for (const comment of jediSegments) {
@@ -11186,7 +11187,7 @@ function buildConversationContext(thread, currentCommentId) {
11186
11187
  lines.push("");
11187
11188
  }
11188
11189
  return { history: lines.join(`
11189
- `), previousJediRuns, isFollowUp };
11190
+ `), previousJediRuns, isFollowUp, isPostImplementation };
11190
11191
  }
11191
11192
  var COMMAND_EMOJI = {
11192
11193
  plan: "\uD83D\uDD2E",
@@ -11321,13 +11322,15 @@ var actionCommand = defineCommand({
11321
11322
  const issueNumber = Number(args["pr-number"] ?? args["issue-number"] ?? 0);
11322
11323
  let conversationHistory = "";
11323
11324
  let isFollowUp = false;
11325
+ let isPostImplementation = false;
11324
11326
  if (repo && issueNumber) {
11325
11327
  const thread = await fetchCommentThread(repo, issueNumber);
11326
11328
  const context = buildConversationContext(thread, commentId ?? 0);
11327
11329
  conversationHistory = context.history;
11328
11330
  isFollowUp = context.isFollowUp;
11331
+ isPostImplementation = context.isPostImplementation;
11329
11332
  if (isFollowUp) {
11330
- consola.info(`Continuing conversation (${context.previousJediRuns} previous Jedi run(s))`);
11333
+ consola.info(`Continuing conversation (${context.previousJediRuns} previous Jedi run(s))${isPostImplementation ? " [post-implementation]" : ""}`);
11331
11334
  }
11332
11335
  }
11333
11336
  const intent = parseComment(args.comment, isFollowUp);
@@ -11339,7 +11342,7 @@ var actionCommand = defineCommand({
11339
11342
  if (repo && commentId) {
11340
11343
  await reactToComment(repo, commentId, "eyes").catch(() => {});
11341
11344
  }
11342
- const commandLabel = intent.isApproval ? "plan" : intent.isFeedback ? "feedback" : intent.command;
11345
+ const commandLabel = intent.isApproval ? "plan" : intent.isFeedback && isPostImplementation ? "implement" : intent.isFeedback ? "feedback" : intent.command;
11343
11346
  let placeholderCommentId = null;
11344
11347
  if (repo && issueNumber) {
11345
11348
  const thinkingBody = `<h3>\uD83E\uDDE0 Jedi <sup>thinking</sup></h3>
@@ -11445,6 +11448,31 @@ _Working on it..._`;
11445
11448
  `Respond with a short confirmation that the plan is approved and ready, then ask:`,
11446
11449
  `"Say **implement** when you're ready to go."`
11447
11450
  ].join(`
11451
+ `);
11452
+ } else if (intent.isFeedback && isPostImplementation) {
11453
+ prompt2 = [
11454
+ `Read ${baseProtocol} for the base agent protocol.`,
11455
+ ``,
11456
+ ...contextLines,
11457
+ ``,
11458
+ conversationHistory,
11459
+ ``,
11460
+ `## Feedback on Implementation`,
11461
+ `> ${intent.description}`,
11462
+ ``,
11463
+ `## Instructions`,
11464
+ `The user is iterating on code that Jedi already implemented. Review the conversation above to understand what was built.`,
11465
+ `Be conversational \u2014 if the user asks a question, answer it first. Then make changes if needed.`,
11466
+ `Apply changes incrementally to the existing code \u2014 do not rewrite from scratch.`,
11467
+ ``,
11468
+ `## Auto-Commit`,
11469
+ `You are already on the correct PR branch. Do NOT create new branches or switch branches.`,
11470
+ `After making changes:`,
11471
+ `1. \`git add\` only source files you changed (NOT .jdi/ or .claude/)`,
11472
+ `2. \`git commit -m "fix: ..."\` or \`git commit -m "refactor: ..."\` with a conventional commit message`,
11473
+ `3. \`git push\` (no -u, no origin, no branch name \u2014 just \`git push\`)`,
11474
+ `Present a summary of what you changed.`
11475
+ ].join(`
11448
11476
  `);
11449
11477
  } else if (intent.isFeedback) {
11450
11478
  const agentSpec = resolve9(cwd, `.jdi/framework/agents/jdi-planner.md`);
@@ -11770,7 +11798,7 @@ var setupActionCommand = defineCommand({
11770
11798
  // package.json
11771
11799
  var package_default = {
11772
11800
  name: "@benzotti/jedi",
11773
- version: "0.1.26",
11801
+ version: "0.1.28",
11774
11802
  description: "JDI - Context-efficient AI development framework for Claude Code",
11775
11803
  type: "module",
11776
11804
  bin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@benzotti/jedi",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "description": "JDI - Context-efficient AI development framework for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {