@benzotti/jedi 0.1.28 → 0.1.29

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.
@@ -30,6 +30,8 @@ on:
30
30
  types: [created]
31
31
  pull_request_review_comment:
32
32
  types: [created]
33
+ pull_request_review:
34
+ types: [submitted]
33
35
  push:
34
36
  branches: [main, master]
35
37
 
@@ -40,23 +42,30 @@ permissions:
40
42
  id-token: write
41
43
 
42
44
  jobs:
43
- # ── Triggered by "Hey Jedi" comments on issues/PRs ──
45
+ # ── Triggered by "Hey Jedi" comments on issues/PRs or PR reviews ──
44
46
  jedi:
45
47
  if: >-
46
- (github.event_name == 'issue_comment' || github.event_name == 'pull_request_review_comment')
47
- && contains(github.event.comment.body, 'Hey Jedi')
48
+ (github.event_name == 'issue_comment' && contains(github.event.comment.body, 'Hey Jedi'))
49
+ || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, 'Hey Jedi'))
50
+ || (github.event_name == 'pull_request_review' && contains(github.event.review.body, 'Hey Jedi'))
48
51
  runs-on: ubuntu-latest
49
52
  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)
53
+ # Resolve the PR head branch
54
+ # - issue_comment: github.head_ref is empty, resolve via API
55
+ # - pull_request_review / pull_request_review_comment: github.event.pull_request.head.ref is available
52
56
  - name: Resolve PR branch
53
57
  id: pr
54
- if: github.event.issue.pull_request
55
58
  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"
59
+ if [ -n "$PR_HEAD_REF" ]; then
60
+ echo "branch=$PR_HEAD_REF" >> "$GITHUB_OUTPUT"
61
+ elif [ -n "$PR_NUMBER" ]; then
62
+ BRANCH=$(gh api repos/${{ github.repository }}/pulls/$PR_NUMBER --jq '.head.ref')
63
+ echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"
64
+ fi
58
65
  env:
59
66
  GH_TOKEN: ${{ github.token }}
67
+ PR_HEAD_REF: ${{ github.event.pull_request.head.ref || '' }}
68
+ PR_NUMBER: ${{ github.event.issue.number || github.event.pull_request.number || '' }}
60
69
 
61
70
  - uses: actions/checkout@v4
62
71
  with:
@@ -118,8 +127,7 @@ jobs:
118
127
  run: bun install -g @anthropic-ai/claude-code
119
128
 
120
129
  # 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)
130
+ # IMPORTANT: All user input is passed via env vars to avoid shell injection
123
131
  - name: Run Jedi
124
132
  run: |
125
133
  ARGS="--repo $REPO"
@@ -129,10 +137,11 @@ jobs:
129
137
 
130
138
  bunx @benzotti/jedi@latest action "$COMMENT_BODY" $ARGS
131
139
  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 }}
140
+ # Resolve comment body from whichever event type triggered this
141
+ COMMENT_BODY: ${{ github.event.comment.body || github.event.review.body || '' }}
142
+ COMMENT_ID: ${{ github.event.comment.id || github.event.review.id || '' }}
143
+ PR_NUMBER: ${{ github.event.issue.number || github.event.pull_request.number || '' }}
144
+ ISSUE_NUMBER: ${{ github.event.issue.number || github.event.pull_request.number || '' }}
136
145
  REPO: ${{ github.repository }}
137
146
  ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
138
147
  CLICKUP_API_TOKEN: ${{ secrets.CLICKUP_API_TOKEN }}
package/dist/index.js CHANGED
@@ -11352,6 +11352,49 @@ var actionCommand = defineCommand({
11352
11352
  _Working on it..._`;
11353
11353
  placeholderCommentId = await postGitHubComment(repo, issueNumber, thinkingBody).catch(() => null);
11354
11354
  }
11355
+ if (intent.isFeedback && intent.isApproval) {
11356
+ const { existsSync: existsSync13 } = await import("fs");
11357
+ const { join: join12 } = await import("path");
11358
+ const statePath = join12(cwd, ".jdi/config/state.yaml");
11359
+ if (existsSync13(statePath)) {
11360
+ const stateContent = await Bun.file(statePath).text();
11361
+ const now = new Date().toISOString();
11362
+ let updated = stateContent;
11363
+ if (/review\.status:/.test(updated)) {
11364
+ updated = updated.replace(/review\.status:\s*.+/, `review.status: approved`);
11365
+ } else {
11366
+ updated += `
11367
+ review.status: approved
11368
+ `;
11369
+ }
11370
+ if (/review\.approved_at:/.test(updated)) {
11371
+ updated = updated.replace(/review\.approved_at:\s*.+/, `review.approved_at: ${now}`);
11372
+ } else {
11373
+ updated += `review.approved_at: ${now}
11374
+ `;
11375
+ }
11376
+ await Bun.write(statePath, updated);
11377
+ }
11378
+ const approvalBody = `Plan approved and locked in.
11379
+
11380
+ Say **\`Hey Jedi implement\`** when you're ready to go.`;
11381
+ const finalBody = formatJediComment("plan", approvalBody);
11382
+ if (repo && placeholderCommentId) {
11383
+ await updateGitHubComment(repo, placeholderCommentId, finalBody).catch((err) => {
11384
+ consola.error("Failed to update approval comment:", err);
11385
+ });
11386
+ } else if (repo && issueNumber) {
11387
+ await postGitHubComment(repo, issueNumber, finalBody).catch((err) => {
11388
+ consola.error("Failed to post approval comment:", err);
11389
+ });
11390
+ } else {
11391
+ console.log(finalBody);
11392
+ }
11393
+ if (repo && commentId) {
11394
+ await reactToComment(repo, commentId, "+1").catch(() => {});
11395
+ }
11396
+ return;
11397
+ }
11355
11398
  if (intent.command === "ping") {
11356
11399
  const { existsSync: existsSync13 } = await import("fs");
11357
11400
  const { join: join12 } = await import("path");
@@ -11430,26 +11473,7 @@ _Working on it..._`;
11430
11473
  }
11431
11474
  const baseProtocol = resolve9(cwd, ".jdi/framework/components/meta/AgentBase.md");
11432
11475
  let prompt2;
11433
- if (intent.isFeedback && intent.isApproval) {
11434
- prompt2 = [
11435
- `Read ${baseProtocol} for the base agent protocol.`,
11436
- ``,
11437
- ...contextLines,
11438
- ``,
11439
- conversationHistory,
11440
- ``,
11441
- `## Plan Approved`,
11442
- `> ${intent.description}`,
11443
- ``,
11444
- `The user has approved the plan. Finalise it:`,
11445
- `1. Read \`.jdi/config/state.yaml\` and update \`review.status\` to "approved" and \`review.approved_at\` to now`,
11446
- `2. Do NOT implement any code \u2014 approval and implementation are separate gates`,
11447
- ``,
11448
- `Respond with a short confirmation that the plan is approved and ready, then ask:`,
11449
- `"Say **implement** when you're ready to go."`
11450
- ].join(`
11451
- `);
11452
- } else if (intent.isFeedback && isPostImplementation) {
11476
+ if (intent.isFeedback && isPostImplementation) {
11453
11477
  prompt2 = [
11454
11478
  `Read ${baseProtocol} for the base agent protocol.`,
11455
11479
  ``,
@@ -11709,7 +11733,7 @@ Use the ClickUp ticket above as the primary requirements source.` : ``,
11709
11733
  if (saved.codebaseIndexSaved)
11710
11734
  consola.info("Codebase index persisted to storage");
11711
11735
  if (repo && issueNumber) {
11712
- const actionLabel = intent.isApproval ? "implement" : intent.isFeedback ? "feedback" : intent.command;
11736
+ const actionLabel = intent.isFeedback ? "feedback" : intent.command;
11713
11737
  let commentBody;
11714
11738
  if (success && fullResponse) {
11715
11739
  commentBody = formatJediComment(actionLabel, fullResponse);
@@ -11798,7 +11822,7 @@ var setupActionCommand = defineCommand({
11798
11822
  // package.json
11799
11823
  var package_default = {
11800
11824
  name: "@benzotti/jedi",
11801
- version: "0.1.28",
11825
+ version: "0.1.29",
11802
11826
  description: "JDI - Context-efficient AI development framework for Claude Code",
11803
11827
  type: "module",
11804
11828
  bin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@benzotti/jedi",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "description": "JDI - Context-efficient AI development framework for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {