mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-19 01:51:21 +08:00
refactor: kilo compat for v1.2.25
This commit is contained in:
+7
-7
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bun
|
||||
|
||||
import { $ } from "bun"
|
||||
import { createOpencode } from "@opencode-ai/sdk/v2"
|
||||
import { createKilo } from "@kilocode/sdk/v2"
|
||||
import { parseArgs } from "util"
|
||||
import { Script } from "@opencode-ai/script"
|
||||
|
||||
@@ -12,7 +12,7 @@ type Release = {
|
||||
}
|
||||
|
||||
export async function getLatestRelease(skip?: string) {
|
||||
const data = await fetch("https://api.github.com/repos/anomalyco/opencode/releases?per_page=100").then((res) => {
|
||||
const data = await fetch("https://api.github.com/repos/Kilo-Org/kilocode/releases?per_page=100").then((res) => {
|
||||
if (!res.ok) throw new Error(res.statusText)
|
||||
return res.json()
|
||||
})
|
||||
@@ -43,7 +43,7 @@ export async function getCommits(from: string, to: string): Promise<Commit[]> {
|
||||
|
||||
// Get commit data with GitHub usernames from the API
|
||||
const compare =
|
||||
await $`gh api "/repos/anomalyco/opencode/compare/${fromRef}...${toRef}" --jq '.commits[] | {sha: .sha, login: .author.login, message: .commit.message}'`.text()
|
||||
await $`gh api "/repos/Kilo-Org/kilocode/compare/${fromRef}...${toRef}" --jq '.commits[] | {sha: .sha, login: .author.login, message: .commit.message}'`.text()
|
||||
|
||||
const commitData = new Map<string, { login: string | null; message: string }>()
|
||||
for (const line of compare.split("\n").filter(Boolean)) {
|
||||
@@ -136,7 +136,7 @@ function getSection(areas: Set<string>): string {
|
||||
return "Core"
|
||||
}
|
||||
|
||||
async function summarizeCommit(opencode: Awaited<ReturnType<typeof createOpencode>>, message: string): Promise<string> {
|
||||
async function summarizeCommit(opencode: Awaited<ReturnType<typeof createKilo>>, message: string): Promise<string> {
|
||||
console.log("summarizing commit:", message)
|
||||
const session = await opencode.client.session.create()
|
||||
const result = await opencode.client.session
|
||||
@@ -164,7 +164,7 @@ Commit: ${message}`,
|
||||
return result.trim()
|
||||
}
|
||||
|
||||
export async function generateChangelog(commits: Commit[], opencode: Awaited<ReturnType<typeof createOpencode>>) {
|
||||
export async function generateChangelog(commits: Commit[], opencode: Awaited<ReturnType<typeof createKilo>>) {
|
||||
// Summarize commits in parallel with max 10 concurrent requests
|
||||
const BATCH_SIZE = 10
|
||||
const summaries: string[] = []
|
||||
@@ -201,7 +201,7 @@ export async function getContributors(from: string, to: string) {
|
||||
const fromRef = from.startsWith("v") ? from : `v${from}`
|
||||
const toRef = to === "HEAD" ? to : to.startsWith("v") ? to : `v${to}`
|
||||
const compare =
|
||||
await $`gh api "/repos/anomalyco/opencode/compare/${fromRef}...${toRef}" --jq '.commits[] | {login: .author.login, message: .commit.message}'`.text()
|
||||
await $`gh api "/repos/Kilo-Org/kilocode/compare/${fromRef}...${toRef}" --jq '.commits[] | {login: .author.login, message: .commit.message}'`.text()
|
||||
const contributors = new Map<string, Set<string>>()
|
||||
|
||||
for (const line of compare.split("\n").filter(Boolean)) {
|
||||
@@ -227,7 +227,7 @@ export async function buildNotes(from: string, to: string) {
|
||||
|
||||
console.log("generating changelog since " + from)
|
||||
|
||||
const opencode = await createOpencode({ port: 0 })
|
||||
const opencode = await createKilo({ port: 0 })
|
||||
const notes: string[] = []
|
||||
|
||||
try {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
import path from "path"
|
||||
import { pathToFileURL } from "bun"
|
||||
import { createOpencode } from "@opencode-ai/sdk"
|
||||
import { createKilo } from "@kilocode/sdk"
|
||||
import { parseArgs } from "util"
|
||||
|
||||
async function main() {
|
||||
@@ -35,7 +35,7 @@ Examples:
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const opencode = await createOpencode({ port: 0 })
|
||||
const opencode = await createKilo({ port: 0 })
|
||||
|
||||
try {
|
||||
const parts: Array<{ type: "text"; text: string } | { type: "file"; url: string; filename: string; mime: string }> =
|
||||
|
||||
+2
-2
@@ -73,7 +73,7 @@ async function fetchReleases(): Promise<Release[]> {
|
||||
const per = 100
|
||||
|
||||
while (true) {
|
||||
const url = `https://api.github.com/repos/anomalyco/opencode/releases?page=${page}&per_page=${per}`
|
||||
const url = `https://api.github.com/repos/Kilo-Org/kilocode/releases?page=${page}&per_page=${per}`
|
||||
|
||||
const response = await fetch(url)
|
||||
if (!response.ok) {
|
||||
@@ -188,7 +188,7 @@ async function save(githubTotal: number, npmDownloads: number) {
|
||||
)
|
||||
}
|
||||
|
||||
console.log("Fetching GitHub releases for anomalyco/opencode...\n")
|
||||
console.log("Fetching GitHub releases for Kilo-Org/kilocode...\n")
|
||||
|
||||
const releases = await fetchReleases()
|
||||
console.log(`\nFetched ${releases.length} releases total\n`)
|
||||
|
||||
Reference in New Issue
Block a user