Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/intent/src/feedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import type {
MetaFeedbackPayload,
} from './types.js'

const META_FEEDBACK_REPO = 'TanStack/intent'

// ---------------------------------------------------------------------------
// Secret detection
// ---------------------------------------------------------------------------
Expand Down Expand Up @@ -326,7 +328,6 @@ export function submitFeedback(

export function submitMetaFeedback(
payload: MetaFeedbackPayload,
repo: string,
opts: { ghAvailable: boolean; outputPath?: string },
): SubmitResult {
const md = metaToMarkdown(payload)
Expand All @@ -335,12 +336,12 @@ export function submitMetaFeedback(
try {
const title = `Meta-Skill Feedback: ${payload.metaSkill} (${payload.userRating})`
execSync(
`gh issue create --repo ${repo} --title "${title.replace(/"/g, '\\"')}" --label "feedback:${payload.metaSkill}" --body -`,
`gh issue create --repo ${META_FEEDBACK_REPO} --title "${title.replace(/"/g, '\\"')}" --label "feedback:${payload.metaSkill}" --body -`,
{ input: md, stdio: ['pipe', 'pipe', 'pipe'] },
)
return {
method: 'gh',
detail: `Submitted issue to ${repo}`,
detail: `Submitted issue to ${META_FEEDBACK_REPO}`,
}
} catch {
// Fall through to file
Expand Down Expand Up @@ -406,10 +407,9 @@ export function runFeedback(args: string[]): void {
}

const payload = raw as MetaFeedbackPayload
const repo = payload.library.replace(/^@/, '').replace(/\//, '/')
const fallbackPath = `intent-meta-feedback-${dateSuffix}.md`

const result = submitMetaFeedback(payload, repo, {
const result = submitMetaFeedback(payload, {
ghAvailable,
outputPath: ghAvailable ? undefined : fallbackPath,
})
Expand All @@ -421,7 +421,7 @@ export function runFeedback(args: string[]): void {
case 'file':
console.log(`✓ ${result.detail}`)
console.log(
`You can manually open an issue at https://github.com/${repo}/issues with this content.`,
`You can manually open an issue at https://github.com/${META_FEEDBACK_REPO}/issues with this content.`,
)
break
case 'stdout':
Expand Down
4 changes: 2 additions & 2 deletions packages/intent/tests/meta-feedback.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ describe('metaToMarkdown', () => {
describe('submitMetaFeedback', () => {
it('saves to file when gh not available and outputPath given', () => {
const outPath = join(tmpDir, 'meta-feedback.md')
const result = submitMetaFeedback(validMetaPayload(), 'TanStack/query', {
const result = submitMetaFeedback(validMetaPayload(), {
ghAvailable: false,
outputPath: outPath,
})
Expand All @@ -190,7 +190,7 @@ describe('submitMetaFeedback', () => {
})

it('returns stdout when no gh and no outputPath', () => {
const result = submitMetaFeedback(validMetaPayload(), 'TanStack/query', {
const result = submitMetaFeedback(validMetaPayload(), {
ghAvailable: false,
})
expect(result.method).toBe('stdout')
Expand Down
Loading