| 111 | } |
| 112 | |
| 113 | async function commits(from: string, to: string) { |
| 114 | const base = ref(from) |
| 115 | const head = ref(to) |
| 116 | |
| 117 | const data = new Map<string, { login: string | null; message: string }>() |
| 118 | for (const item of await diff(base, head)) { |
| 119 | data.set(item.sha, { login: item.login, message: item.message.split("\n")[0] ?? "" }) |
| 120 | } |
| 121 | |
| 122 | const log = |
| 123 | await $`git log ${base}..${head} --format=%H -- packages/opencode packages/sdk packages/plugin packages/desktop packages/app sdks/vscode packages/extensions github`.text() |
| 124 | |
| 125 | const list: Commit[] = [] |
| 126 | for (const hash of log.split("\n").filter(Boolean)) { |
| 127 | const item = data.get(hash) |
| 128 | if (!item) continue |
| 129 | if (item.message.match(/^(ignore:|test:|chore:|ci:|release:)/i)) continue |
| 130 | |
| 131 | const diff = await $`git diff-tree --no-commit-id --name-only -r ${hash}`.text() |
| 132 | const areas = new Set<string>() |
| 133 | |
| 134 | for (const file of diff.split("\n").filter(Boolean)) { |
| 135 | if (file.startsWith("packages/opencode/src/cli/cmd/")) areas.add("tui") |
| 136 | else if (file.startsWith("packages/opencode/")) areas.add("core") |
| 137 | else if (file.startsWith("packages/desktop/src-tauri/")) areas.add("tauri") |
| 138 | else if (file.startsWith("packages/desktop/") || file.startsWith("packages/app/")) areas.add("app") |
| 139 | else if (file.startsWith("packages/sdk/") || file.startsWith("packages/plugin/")) areas.add("sdk") |
| 140 | else if (file.startsWith("sdks/vscode/") || file.startsWith("github/")) areas.add("extensions/vscode") |
| 141 | } |
| 142 | |
| 143 | if (areas.size === 0) continue |
| 144 | |
| 145 | list.push({ |
| 146 | hash: hash.slice(0, 7), |
| 147 | author: item.login, |
| 148 | message: item.message, |
| 149 | areas, |
| 150 | }) |
| 151 | } |
| 152 | |
| 153 | return reverted(list) |
| 154 | } |
| 155 | |
| 156 | async function contributors(from: string, to: string) { |
| 157 | const base = ref(from) |