@karajan-family/code 4.70.0 → 4.70.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@karajan-family/code",
3
- "version": "4.70.0",
3
+ "version": "4.70.1",
4
4
  "description": "Local multi-agent coding orchestrator with TDD, SonarQube, and code review pipeline",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0",
@@ -69,10 +69,13 @@ export const WORKFLOWS = [
69
69
  // npx PINEADO a la versión del kj que corrió harden — jamás @latest en CI.
70
70
  // KJC-BUG-0399: the judge is never the PR's code. A repo that ships kj itself
71
71
  // judges with the kj of the BASE branch, checked out apart; the PR is only data.
72
+ // KJC-BUG-0419: on `pull_request` GitHub runs the PR's own copy of this YAML, so a
73
+ // PR could rewrite its judge. `pull_request_target` runs the base's YAML; the PR
74
+ // is fetched into its own worktree, read by kj and never installed nor executed.
72
75
  export const policyWorkflowFor = (kjVersion, kjName = "karajan-code") => [
73
76
  "name: Policy",
74
77
  "on:",
75
- " pull_request:",
78
+ " pull_request_target:",
76
79
  "permissions:",
77
80
  " contents: read",
78
81
  "jobs:",
@@ -88,16 +91,23 @@ export const policyWorkflowFor = (kjVersion, kjName = "karajan-code") => [
88
91
  " - name: kj policy check (strict) on the PR diff",
89
92
  " env:",
90
93
  " BASE_REF: ${{ github.base_ref }}",
94
+ " PR_NUMBER: ${{ github.event.pull_request.number }}",
91
95
  " run: |",
92
96
  ' JUDGE="$RUNNER_TEMP/kj-judge"',
97
+ ' PR_TREE="$RUNNER_TEMP/kj-pr"',
93
98
  ' git fetch --no-tags origin "${BASE_REF}:refs/remotes/origin/${BASE_REF}"',
99
+ ' git fetch --no-tags origin "+refs/pull/${PR_NUMBER}/head:refs/remotes/origin/kj-pr-head"',
94
100
  ' if git cat-file -e "origin/${BASE_REF}:bin/kj.js" 2>/dev/null; then',
95
101
  ' git worktree add --detach "$JUDGE" "origin/${BASE_REF}"',
96
102
  ' (cd "$JUDGE" && npm ci --ignore-scripts)',
97
103
  ' KJ="node $JUDGE/bin/kj.js"',
98
104
  " else",
99
- ` KJ="npx --yes ${kjName}@${kjVersion}"`,
105
+ ' mkdir -p "$JUDGE"',
106
+ ` (cd "$JUDGE" && echo '{"private":true}' > package.json && npm install --no-save --ignore-scripts --no-audit --no-fund ${kjName}@${kjVersion})`,
107
+ ` KJ="node $JUDGE/node_modules/${kjName}/bin/kj.js"`,
100
108
  " fi",
109
+ ' git worktree add --detach "$PR_TREE" origin/kj-pr-head',
110
+ ' cd "$PR_TREE"',
101
111
  ' $KJ policy check --range "origin/${BASE_REF}...HEAD" --strict',
102
112
  ].join("\n");
103
113