Skip to content

Commit ec17b06

Browse files
authored
Merge pull request #7 from Multiplier-Labs/fix/remove-local-scripts
Fix workflow reports: dedicated branch, push, and clean output dirs
2 parents 48c1c4f + 5805e94 commit ec17b06

12 files changed

+172
-19
lines changed

dist/assets/index-CPxHiZP2.js

Lines changed: 105 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assets/index-DU_Viph_.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
66
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
77
<title>Codekin</title>
8-
<script type="module" crossorigin src="/assets/index-DhHz_GYL.js"></script>
8+
<script type="module" crossorigin src="/assets/index-CPxHiZP2.js"></script>
99
<link rel="stylesheet" crossorigin href="/assets/index-DU_Viph_.css">
1010
</head>
1111
<body class="bg-neutral-12 text-neutral-2">

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codekin",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"license": "MIT",
55
"author": "multiplier-labs",
66
"description": "Web UI for Claude Code sessions with multi-session support and WebSocket streaming",
@@ -11,7 +11,12 @@
1111
"bugs": {
1212
"url": "https://github.com/Multiplier-Labs/codekin/issues"
1313
},
14-
"keywords": ["claude", "terminal", "ai", "coding-assistant"],
14+
"keywords": [
15+
"claude",
16+
"terminal",
17+
"ai",
18+
"coding-assistant"
19+
],
1520
"type": "module",
1621
"bin": {
1722
"codekin": "bin/codekin.mjs"

server/workflow-loader.ts

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
* 1. validate_repo — verify path exists, is a git repo, check staleness
99
* 2. create_session — create a Codekin session for the run
1010
* 3. run_prompt — start Claude, send the prompt, wait for result
11-
* 4. save_report — write Markdown output to outputDir, commit
11+
* 4. save_report — write Markdown output to outputDir, commit on codekin/reports branch, push
1212
*
1313
* MD file format — YAML frontmatter followed by the Claude prompt:
1414
*
1515
* ---
1616
* kind: code-review.daily
1717
* name: Daily Code Review
1818
* sessionPrefix: review
19-
* outputDir: review logs
19+
* outputDir: .codekin/reports/code-review
2020
* filenameSuffix: _code-review-daily.md
2121
* commitMessage: chore: code review
2222
* ---
@@ -312,14 +312,56 @@ function registerWorkflow(engine: WorkflowEngine, sessions: SessionManager, def:
312312

313313
console.log(`[workflow:${def.kind}] Saved report to ${filePath}`)
314314

315+
// Commit on a dedicated branch so reports don't pollute the working branch
316+
const REPORTS_BRANCH = 'codekin/reports'
315317
try {
316318
const relativePath = `${def.outputDir}/${filename}`
317-
execSync(`git add "${relativePath}"`, { cwd: repoPath, timeout: 10_000 })
318-
execSync(
319-
`git commit -m "${def.commitMessage} ${dateStr}"`,
320-
{ cwd: repoPath, timeout: 15_000 }
321-
)
322-
console.log(`[workflow:${def.kind}] Committed ${relativePath}`)
319+
const originalBranch = execSync('git rev-parse --abbrev-ref HEAD', { cwd: repoPath, timeout: 5_000 }).toString().trim()
320+
321+
// Ensure the reports branch exists (create as orphan if needed)
322+
try {
323+
execSync(`git rev-parse --verify ${REPORTS_BRANCH}`, { cwd: repoPath, timeout: 5_000, stdio: 'pipe' })
324+
} catch {
325+
// Branch doesn't exist yet — create it from the current branch
326+
execSync(`git branch ${REPORTS_BRANCH}`, { cwd: repoPath, timeout: 5_000 })
327+
console.log(`[workflow:${def.kind}] Created branch ${REPORTS_BRANCH}`)
328+
}
329+
330+
// Stash any uncommitted changes on the working branch
331+
const stashResult = execSync('git stash --include-untracked', { cwd: repoPath, timeout: 10_000 }).toString().trim()
332+
const didStash = !stashResult.includes('No local changes')
333+
334+
try {
335+
execSync(`git checkout ${REPORTS_BRANCH}`, { cwd: repoPath, timeout: 10_000 })
336+
337+
// Re-create the report file on this branch (the file was written while on the original branch)
338+
const reportsDirOnBranch = join(repoPath, def.outputDir)
339+
if (!existsSync(reportsDirOnBranch)) {
340+
mkdirSync(reportsDirOnBranch, { recursive: true })
341+
}
342+
writeFileSync(join(reportsDirOnBranch, filename), markdown, 'utf-8')
343+
344+
execSync(`git add "${relativePath}"`, { cwd: repoPath, timeout: 10_000 })
345+
execSync(
346+
`git commit -m "${def.commitMessage} ${dateStr}"`,
347+
{ cwd: repoPath, timeout: 15_000 }
348+
)
349+
console.log(`[workflow:${def.kind}] Committed ${relativePath} on ${REPORTS_BRANCH}`)
350+
351+
// Push to remote
352+
try {
353+
execSync(`git push origin ${REPORTS_BRANCH}`, { cwd: repoPath, timeout: 30_000, stdio: 'pipe' })
354+
console.log(`[workflow:${def.kind}] Pushed ${REPORTS_BRANCH} to origin`)
355+
} catch (pushErr) {
356+
console.warn(`[workflow:${def.kind}] Could not push ${REPORTS_BRANCH}: ${pushErr}`)
357+
}
358+
} finally {
359+
// Always switch back to the original branch
360+
execSync(`git checkout ${originalBranch}`, { cwd: repoPath, timeout: 10_000 })
361+
if (didStash) {
362+
execSync('git stash pop', { cwd: repoPath, timeout: 10_000 })
363+
}
364+
}
323365
} catch (err) {
324366
console.warn(`[workflow:${def.kind}] Could not commit report: ${err}`)
325367
}

server/workflows/code-review.daily.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
kind: code-review.daily
33
name: Daily Code Review
44
sessionPrefix: review
5-
outputDir: review logs
5+
outputDir: .codekin/reports/code-review
66
filenameSuffix: _code-review-daily.md
77
commitMessage: chore: code review
88
---

server/workflows/comment-assessment.daily.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
kind: comment-assessment.daily
33
name: Comment Assessment
44
sessionPrefix: comments
5-
outputDir: comment-reports
5+
outputDir: .codekin/reports/comments
66
filenameSuffix: _comment-assessment.md
77
commitMessage: chore: comment assessment
88
---

server/workflows/complexity.weekly.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
kind: complexity.weekly
33
name: Complexity Report
44
sessionPrefix: complexity
5-
outputDir: complexity-reports
5+
outputDir: .codekin/reports/complexity
66
filenameSuffix: _complexity-report.md
77
commitMessage: chore: complexity report
88
---

server/workflows/coverage.daily.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
kind: coverage.daily
33
name: Coverage Assessment
44
sessionPrefix: coverage
5-
outputDir: coverage-reports
5+
outputDir: .codekin/reports/coverage
66
filenameSuffix: _coverage-assessment.md
77
commitMessage: chore: coverage report
88
---

0 commit comments

Comments
 (0)