@benzotti/jedi 0.1.37 → 0.1.39

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.
@@ -9,7 +9,7 @@
9
9
  # - Set CLICKUP_API_TOKEN secret for ClickUp ticket integration
10
10
  # - Set JEDI_COMMIT_LEARNINGS=true repo variable to persist learnings in git
11
11
  # - Set JEDI_LEARNINGS_REPO variable to push learnings to a central repo (e.g. org/jedi-learnings)
12
- # - Set JEDI_LEARNINGS_TOKEN secret (PAT with repo access) when using an external learnings repo
12
+ # - Set JEDI_LEARNINGS_TOKEN secret (PAT with Contents read/write on the learnings repo)
13
13
  # - Run `npx @benzotti/jedi init` locally to customise framework files
14
14
  #
15
15
  # Usage: Comment on any issue or PR with "Hey Jedi" followed by a command:
@@ -127,10 +127,10 @@ jobs:
127
127
  if: vars.JEDI_LEARNINGS_REPO != ''
128
128
  run: |
129
129
  LEARNINGS_DIR=".jdi/framework/learnings"
130
+ REMOTE_SUBDIR="jedi/learnings"
130
131
  mkdir -p "$LEARNINGS_DIR"
131
132
 
132
- # Clone only the directory for this repo's learnings (sparse checkout)
133
- REPO_SUBDIR="${{ github.repository }}"
133
+ # Clone only the learnings directory (sparse checkout)
134
134
  TMPDIR=$(mktemp -d)
135
135
  git clone --depth 1 --filter=blob:none --sparse \
136
136
  "https://x-access-token:${LEARNINGS_TOKEN}@github.com/${LEARNINGS_REPO}.git" \
@@ -140,23 +140,38 @@ jobs:
140
140
  }
141
141
 
142
142
  cd "$TMPDIR"
143
- git sparse-checkout set "$REPO_SUBDIR" 2>/dev/null || true
143
+ git sparse-checkout set "$REMOTE_SUBDIR" 2>/dev/null || true
144
144
  cd - > /dev/null
145
145
 
146
- # Copy learnings from external repo into local framework
147
- # External learnings serve as baseline; cache/local files take precedence
148
- if [ -d "$TMPDIR/$REPO_SUBDIR" ]; then
149
- for f in "$TMPDIR/$REPO_SUBDIR"/*.md; do
146
+ # Merge learnings from external repo into local framework
147
+ if [ -d "$TMPDIR/$REMOTE_SUBDIR" ]; then
148
+ for f in "$TMPDIR/$REMOTE_SUBDIR"/*.md; do
150
149
  [ -f "$f" ] || continue
151
150
  BASENAME=$(basename "$f")
152
- # Only copy if local file doesn't exist (cache/committed files take precedence)
153
- if [ ! -f "$LEARNINGS_DIR/$BASENAME" ]; then
154
- cp "$f" "$LEARNINGS_DIR/$BASENAME"
151
+ LOCAL_FILE="$LEARNINGS_DIR/$BASENAME"
152
+
153
+ if [ ! -f "$LOCAL_FILE" ]; then
154
+ cp "$f" "$LOCAL_FILE"
155
155
  echo "Loaded shared learning: $BASENAME"
156
+ else
157
+ # Append lines from remote that aren't already in the local file
158
+ MERGED=0
159
+ while IFS= read -r line; do
160
+ [ -z "$line" ] && continue
161
+ if ! grep -qFx "$line" "$LOCAL_FILE" 2>/dev/null; then
162
+ echo "$line" >> "$LOCAL_FILE"
163
+ MERGED=$((MERGED + 1))
164
+ fi
165
+ done < "$f"
166
+ if [ "$MERGED" -gt 0 ]; then
167
+ echo "Merged $MERGED new lines into $BASENAME"
168
+ else
169
+ echo "No new learnings to merge for $BASENAME"
170
+ fi
156
171
  fi
157
172
  done
158
173
  else
159
- echo "No shared learnings found for ${{ github.repository }} — continuing"
174
+ echo "No shared learnings found — continuing"
160
175
  fi
161
176
 
162
177
  rm -rf "$TMPDIR"
@@ -292,8 +307,8 @@ jobs:
292
307
  # Where learnings are committed:
293
308
  # - Same repo (default): .jdi/framework/learnings/ on main
294
309
  # - External repo: set JEDI_LEARNINGS_REPO (e.g. org/jedi-learnings)
295
- # and JEDI_LEARNINGS_TOKEN secret. Learnings are namespaced under
296
- # <owner>/<repo>/ in the external repo to support multiple projects.
310
+ # and JEDI_LEARNINGS_TOKEN secret. Learnings are stored under
311
+ # jedi/learnings/ in the external repo and merged (not replaced).
297
312
  - name: Commit learnings to repo
298
313
  if: >-
299
314
  steps.check.outputs.skip != 'true'
@@ -301,6 +316,7 @@ jobs:
301
316
  && vars.JEDI_COMMIT_LEARNINGS == 'true'
302
317
  run: |
303
318
  LEARNINGS_SRC=".jdi/framework/learnings"
319
+ REMOTE_SUBDIR="jedi/learnings"
304
320
 
305
321
  # Only proceed if there are learnings files with content
306
322
  if [ ! -d "$LEARNINGS_SRC" ]; then
@@ -327,8 +343,7 @@ jobs:
327
343
  git config user.email "jedi[bot]@users.noreply.github.com"
328
344
 
329
345
  if [ -n "$LEARNINGS_REPO" ]; then
330
- # ── External repo: clone, copy learnings, push ──
331
- REPO_SUBDIR="${{ github.repository }}"
346
+ # ── External repo: clone, merge learnings, push ──
332
347
  TMPDIR=$(mktemp -d)
333
348
 
334
349
  git clone --depth 1 \
@@ -338,13 +353,33 @@ jobs:
338
353
  exit 0
339
354
  }
340
355
 
341
- mkdir -p "$TMPDIR/$REPO_SUBDIR"
342
- cp "$LEARNINGS_SRC"/*.md "$TMPDIR/$REPO_SUBDIR/"
356
+ mkdir -p "$TMPDIR/$REMOTE_SUBDIR"
357
+
358
+ # Merge learnings: append new lines from local that don't exist in remote
359
+ for f in "$LEARNINGS_SRC"/*.md; do
360
+ [ -f "$f" ] || continue
361
+ BASENAME=$(basename "$f")
362
+ REMOTE_FILE="$TMPDIR/$REMOTE_SUBDIR/$BASENAME"
363
+
364
+ if [ -f "$REMOTE_FILE" ]; then
365
+ # Append lines from local that aren't already in the remote file
366
+ while IFS= read -r line; do
367
+ [ -z "$line" ] && continue
368
+ if ! grep -qFx "$line" "$REMOTE_FILE" 2>/dev/null; then
369
+ echo "$line" >> "$REMOTE_FILE"
370
+ fi
371
+ done < "$f"
372
+ echo "Merged learning: $BASENAME"
373
+ else
374
+ cp "$f" "$REMOTE_FILE"
375
+ echo "Added new learning: $BASENAME"
376
+ fi
377
+ done
343
378
 
344
379
  cd "$TMPDIR"
345
380
  git config user.name "jedi[bot]"
346
381
  git config user.email "jedi[bot]@users.noreply.github.com"
347
- git add "$REPO_SUBDIR"/*.md
382
+ git add "$REMOTE_SUBDIR"/*.md
348
383
 
349
384
  if git diff --cached --quiet; then
350
385
  echo "Learnings unchanged in external repo — nothing to commit"
@@ -354,7 +389,7 @@ jobs:
354
389
  Source: PR #${{ steps.check.outputs.pr_number }} on ${{ github.repository }}
355
390
  Learnings accumulated from PR reviews and feedback."
356
391
  git push
357
- echo "Learnings committed to ${LEARNINGS_REPO}/${REPO_SUBDIR}"
392
+ echo "Learnings committed to ${LEARNINGS_REPO}/$REMOTE_SUBDIR"
358
393
  fi
359
394
 
360
395
  cd - > /dev/null
package/dist/index.js CHANGED
@@ -12294,7 +12294,7 @@ var stateCommand = defineCommand({
12294
12294
  // package.json
12295
12295
  var package_default = {
12296
12296
  name: "@benzotti/jedi",
12297
- version: "0.1.37",
12297
+ version: "0.1.39",
12298
12298
  description: "JDI - Context-efficient AI development framework for Claude Code",
12299
12299
  type: "module",
12300
12300
  bin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@benzotti/jedi",
3
- "version": "0.1.37",
3
+ "version": "0.1.39",
4
4
  "description": "JDI - Context-efficient AI development framework for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {