karajan-code 4.41.0 → 4.43.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.
Files changed (41) hide show
  1. package/package.json +1 -1
  2. package/src/commands/harden.js +14 -0
  3. package/src/commands/init.js +7 -1
  4. package/src/commands/pr-size.js +10 -4
  5. package/src/config/defaults.js +5 -1
  6. package/src/config/schema.js +5 -0
  7. package/src/config/test-harness.js +5 -0
  8. package/src/environment/contract-commit.js +11 -1
  9. package/src/git/automation.js +49 -8
  10. package/src/git/coder-commit-guard.js +40 -0
  11. package/src/harden/hook-templates.js +6 -0
  12. package/src/harden/sentinel/sentinel-shell.mjs +7 -3
  13. package/src/harden/sentinel-hooks.js +83 -11
  14. package/src/orchestrator/config-init.js +4 -2
  15. package/src/orchestrator/drivers/iteration-phases/quality-gates.js +7 -0
  16. package/src/orchestrator/drivers/iteration-phases/reviewer-gate.js +3 -1
  17. package/src/orchestrator/drivers/post-loop.js +1 -1
  18. package/src/orchestrator/preflight-checks.js +11 -8
  19. package/src/orchestrator/stages/coder-stage.js +16 -0
  20. package/src/orchestrator/stages/reviewer-stage.js +13 -11
  21. package/src/orchestrator/stages/suite-green-stage.js +55 -0
  22. package/src/prompts/coder.js +3 -1
  23. package/src/rag/indexer.js +8 -6
  24. package/src/review/gate-gitignore.js +2 -0
  25. package/src/review/verdict-store.js +4 -2
  26. package/src/roles/domain-curator-role.js +6 -13
  27. package/src/roles/reviewer-role.js +23 -12
  28. package/src/sonar/scanner.js +22 -5
  29. package/src/utils/git.js +44 -18
  30. package/src/utils/run-log.js +8 -0
  31. package/templates/coder-rules.md +1 -1
  32. package/templates/roles/coder/anthropic.md +2 -2
  33. package/templates/roles/coder/default.md +2 -2
  34. package/templates/roles/coder/google.md +2 -2
  35. package/templates/roles/coder/openai.md +2 -2
  36. package/templates/roles/coder/opencode.md +1 -1
  37. package/templates/roles/coder.md +2 -2
  38. package/templates/roles/refactorer.md +1 -1
  39. package/templates/skills/kj-code.md +1 -1
  40. package/templates/skills/kj-review.md +1 -1
  41. package/templates/skills/kj-sonar.md +4 -3
@@ -119,13 +119,13 @@ When modifying an existing project:
119
119
  - NEVER overwrite existing files entirely. Always make targeted, minimal edits.
120
120
  - When adding new code to an existing file, insert only the new lines at the correct location.
121
121
  - After each edit, verify with `git diff` that ONLY the intended lines changed.
122
- - If unintended changes are detected, revert immediately with `git checkout -- <file>`.
122
+ - If unintended changes are detected, undo ONLY those hunks with a targeted edit. Never revert the whole file: it may hold edits that are not yours.
123
123
  - Pay special attention to CSS, HTML, and config files where full rewrites destroy prior work.
124
124
 
125
125
  ## Code Quality Rules
126
126
 
127
127
  - Follow SOLID principles. Write small, focused functions (< 30 lines).
128
- - Make atomic commits: 1 logical change = 1 commit. Keep PRs small and reviewable.
128
+ - One logical change per task; keep it small and reviewable. NEVER run git commit or git push: the pipeline commits once the review approves.
129
129
  - Security: use httpOnly cookies for auth tokens, validate all input, parameterize queries, never expose secrets.
130
130
  - No console.log in production code -- use a structured logger. No 'any' types -- use JSDoc annotations.
131
131
 
@@ -22,7 +22,7 @@ You are the **Refactorer** in a multi-role AI pipeline. Your job is to improve c
22
22
 
23
23
  - NEVER overwrite existing files entirely. Always make targeted, minimal edits.
24
24
  - After each edit, verify with `git diff` that ONLY the intended lines changed.
25
- - If unintended changes are detected, revert immediately with `git checkout -- <file>`.
25
+ - If unintended changes are detected, undo ONLY those hunks with a targeted edit. Never revert the whole file: it may hold edits that are not yours.
26
26
 
27
27
  ## Output format
28
28
 
@@ -40,7 +40,7 @@ After writing code, verify ALL of these before reporting done:
40
40
 
41
41
  - NEVER overwrite existing files entirely — make targeted edits
42
42
  - After each edit, verify with `git diff` that ONLY intended lines changed
43
- - If unintended changes detected, revert immediately with `git checkout -- <file>`
43
+ - If unintended changes are detected, undo ONLY those hunks with a targeted edit. Never revert the whole file: it may hold edits you did not make, and an agent never discards changes that are not its own
44
44
 
45
45
  ## Completeness check
46
46
 
@@ -8,7 +8,7 @@ Review the changes in the current branch: $ARGUMENTS
8
8
 
9
9
  ## Steps
10
10
 
11
- 1. Run `git diff main...HEAD` (or appropriate base branch) to see all changes
11
+ 1. See ALL the work: `git diff --cached` (staged), `git diff` (unstaged) and `git diff main...HEAD` (or the appropriate base branch) for what is already committed
12
12
  2. Review each changed file against the priorities below
13
13
  3. Report findings clearly
14
14
 
@@ -13,14 +13,15 @@ $ARGUMENTS
13
13
  ```bash
14
14
  npx @sonar/scan -Dsonar.host.url=http://localhost:9000 -Dsonar.projectKey=<project-key>
15
15
  ```
16
- 3. Check quality gate status:
16
+ 3. Check quality gate status (the token comes from `KJ_SONAR_TOKEN`, set by `kj init`; a token authenticates as `token:` with an empty password):
17
17
  ```bash
18
- curl -s -u admin:admin "http://localhost:9000/api/qualitygates/project_status?projectKey=<project-key>"
18
+ curl -s -u "$KJ_SONAR_TOKEN:" "http://localhost:9000/api/qualitygates/project_status?projectKey=<project-key>"
19
19
  ```
20
20
  4. List issues:
21
21
  ```bash
22
- curl -s -u admin:admin "http://localhost:9000/api/issues/search?projectKeys=<project-key>&statuses=OPEN&ps=50"
22
+ curl -s -u "$KJ_SONAR_TOKEN:" "http://localhost:9000/api/issues/search?projectKeys=<project-key>&statuses=OPEN&ps=50"
23
23
  ```
24
+ Never authenticate with the default `admin` account: if the server still accepts its default password, tell the user to change it.
24
25
 
25
26
  ## If SonarQube is not available
26
27