GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(opencode): add ollama init cli command to generate opencode.json config dynamically by tobocop2 · Pull Request #4183 · anomalyco/opencode

feat(opencode): add ollama init cli command to generate opencode.json config dynamically #4183

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tobocop2 wants to merge 10 commits into anomalyco:dev from tobocop2:add-ollama-command

Uh oh!

There was an error while loading. Please reload this page.

Closed

feat(opencode): add ollama init cli command to generate opencode.json config dynamically #4183

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit Hold shift + click to select a range
0b8160a
Introduce ollama config generation command
tobocop2 Nov 11, 2025
291d7a4
Merge branch 'dev' into add-ollama-command
tobocop2 Nov 17, 2025
a946910
Merge branch 'dev' into add-ollama-command
tobocop2 Nov 17, 2025
a92ca08
Merge branch 'dev' into add-ollama-command
tobocop2 Nov 19, 2025
ce21ae4
chore: format code
actions-user Nov 19, 2025
729b643
Merge branch 'dev' into add-ollama-command
tobocop2 Nov 20, 2025
7e5bac7
chore: format code
actions-user Nov 20, 2025
5ecd8d4
Merge branch 'dev' into add-ollama-command
tobocop2 Nov 27, 2025
a768476
Merge branch 'dev' into add-ollama-command
tobocop2 Jan 8, 2026
fe52700
Merge branch 'dev' into add-ollama-command
tobocop2 Jan 8, 2026
File filter
Filter by extension

Clear filters
Conversations
Failed to load comments.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Jump to
Jump to file
Failed to load files.
Loading

Uh oh!

There was an error while loading. Please reload this page.

Diff view
Diff view
Prev Previous commit
Next Next commit
chore: format code
  • Loading branch information

Uh oh!

There was an error while loading. Please reload this page.

@actions-user
actions-user committed Nov 19, 2025
commit ce21ae451258e9a4521caf7f814aa3f5bac3fb76

There are no files selected for viewing

8 changes: 2 additions & 6 deletions 8 packages/opencode/src/cli/cmd/ollama.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,7 @@ export const OllamaInitCommand = cmd({

const onError = () => {
prompts.log.error("Ollama not found in PATH")
prompts.log.info(
"Install Ollama from https://ollama.com or ensure it's in your PATH",
)
prompts.log.info("Install Ollama from https://ollama.com or ensure it's in your PATH")
throw new UI.CancelledError()
}

Expand All @@ -119,9 +117,7 @@ export const OllamaInitCommand = cmd({
})

const lines = result.split("\n").slice(1) // Skip header
const modelsList = lines
.map((line) => line.trim().split(/\s+/)[0])
.filter((name) => name && name.length > 0)
const modelsList = lines.map((line) => line.trim().split(/\s+/)[0]).filter((name) => name && name.length > 0)

if (modelsList.length === 0) {
prompts.log.warning("No models found from 'ollama list'")
Expand Down
16 changes: 4 additions & 12 deletions 16 packages/opencode/test/cli/cmd/ollama.test.ts
Show comments
View file
Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ fi

// Run the ollama init command
const outputFile = path.join(tmp.path, "test-config.json")
await $`bun run ${path.join(__dirname, "../../../src/index.ts")} ollama init ${outputFile} -y`
.cwd(tmp.path)
.quiet()
await $`bun run ${path.join(__dirname, "../../../src/index.ts")} ollama init ${outputFile} -y`.cwd(tmp.path).quiet()

// Verify the config file was created
const configContent = await Bun.file(outputFile).text()
Expand Down Expand Up @@ -123,9 +121,7 @@ fi
},
})

await $`bun run ${path.join(__dirname, "../../../src/index.ts")} ollama init -y`
.cwd(tmp.path)
.quiet()
await $`bun run ${path.join(__dirname, "../../../src/index.ts")} ollama init -y`.cwd(tmp.path).quiet()

// Verify default filename was used
const defaultFile = path.join(tmp.path, "opencode.json")
Expand Down Expand Up @@ -235,9 +231,7 @@ fi

const outputFile = path.join(tmp.path, "existing-config.json")

await $`bun run ${path.join(__dirname, "../../../src/index.ts")} ollama init ${outputFile} -y`
.cwd(tmp.path)
.quiet()
await $`bun run ${path.join(__dirname, "../../../src/index.ts")} ollama init ${outputFile} -y`.cwd(tmp.path).quiet()

const configContent = await Bun.file(outputFile).text()
const config = JSON.parse(configContent)
Expand Down Expand Up @@ -282,9 +276,7 @@ fi
await fs.mkdir(testConfigDir, { recursive: true })
process.env.XDG_CONFIG_HOME = path.join(tmp.path, ".config")

await $`bun run ${path.join(__dirname, "../../../src/index.ts")} ollama init --global -y`
.cwd(tmp.path)
.quiet()
await $`bun run ${path.join(__dirname, "../../../src/index.ts")} ollama init --global -y`.cwd(tmp.path).quiet()

// Restore original XDG_CONFIG_HOME
if (originalConfigHome) {
Expand Down
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.