Skip to content

Conversation

@ryoppippi
Copy link
Member

@ryoppippi ryoppippi commented Dec 9, 2025

Create a central consts.ts file with DEFAULT_BASE_URL constant and use it as the default value in StackOneToolSet constructor. This allows users to use the SDK without explicitly providing a baseUrl.

Closes #149


Summary by cubic

Set a default base URL for the StackOne API so the SDK works without passing baseUrl. Centralized DEFAULT_BASE_URL and applied it across the toolset and feedback tool, with support for env var override.

  • Bug Fixes

    • Added DEFAULT_BASE_URL ('https://api.stackone.com') in consts.ts and exported from index.
    • StackOneToolSet and feedback tool now default to DEFAULT_BASE_URL, with StackOneToolSet falling back to process.env.STACKONE_BASE_URL if set.
  • Refactors

    • Consolidated constants into consts.ts, moved DEFAULT_HYBRID_ALPHA there, updated imports, and re-exported from index.

Written for commit 6480c00. Summary will update automatically on new commits.

Copilot AI review requested due to automatic review settings December 9, 2025 03:12
@ryoppippi ryoppippi requested a review from a team as a code owner December 9, 2025 03:12
Create a central consts.ts file with DEFAULT_BASE_URL constant and use it
as the default value in StackOneToolSet constructor. This allows users to
use the SDK without explicitly providing a baseUrl.

Closes #149
@ryoppippi ryoppippi force-pushed the claude/fix-issue-149-01FJuzkd3XSwVjj6zK6vC8gn branch from 4f11124 to 4020632 Compare December 9, 2025 03:13
@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 9, 2025

Open in StackBlitz

npm i https://pkg.pr.new/StackOneHQ/stackone-ai-node/@stackone/ai@164

commit: 4020632

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR centralizes the default StackOne API base URL by creating a DEFAULT_BASE_URL constant and using it consistently across the codebase. This allows users to instantiate the SDK without explicitly providing a baseUrl parameter.

Key changes:

  • Created a new constants file with DEFAULT_BASE_URL = 'https://api.stackone.com'
  • Updated StackOneToolSet constructor to use a fallback chain: config?.baseUrl || env.STACKONE_BASE_URL || DEFAULT_BASE_URL
  • Replaced hardcoded URL strings in createFeedbackTool with the constant
  • Exported the constant from the main index file for public use

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/consts.ts New file defining the DEFAULT_BASE_URL constant for the StackOne API
src/toolsets/stackone.ts Updated to import and use DEFAULT_BASE_URL as the final fallback in the baseUrl resolution chain
src/tools/feedback.ts Replaced hardcoded 'https://api.stackone.com' strings with DEFAULT_BASE_URL constant
src/index.ts Exported DEFAULT_BASE_URL to make it available for public use

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +4
/**
* Default base URL for StackOne API
*/
export const DEFAULT_BASE_URL = 'https://api.stackone.com';
Copy link

Copilot AI Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new file is named consts.ts, but there's already an existing constants.ts file in the same directory (containing DEFAULT_HYBRID_ALPHA). For consistency, consider either:

  1. Adding DEFAULT_BASE_URL to the existing constants.ts file instead of creating a new consts.ts file, or
  2. Renaming this file to match the existing constants.ts naming convention

This would maintain a consistent naming pattern across the codebase.

Suggested change
/**
* Default base URL for StackOne API
*/
export const DEFAULT_BASE_URL = 'https://api.stackone.com';

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply the first solution

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Copy link

Copilot AI commented Dec 9, 2025

@ryoppippi I've opened a new pull request, #165, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

@glebedel glebedel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

- Move DEFAULT_HYBRID_ALPHA from constants.ts to consts.ts
- Update import in tool.ts to use consts module
- Export DEFAULT_HYBRID_ALPHA from index.ts for consistency
- Remove redundant constants.ts file

This improves consistency by having all constants in a single file
rather than split across constants.ts and consts.ts.
@ryoppippi ryoppippi merged commit 83ad198 into main Dec 9, 2025
7 checks passed
@ryoppippi ryoppippi deleted the claude/fix-issue-149-01FJuzkd3XSwVjj6zK6vC8gn branch December 9, 2025 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

set default baseUrl

4 participants