diff --git a/packages/intent/src/feedback.ts b/packages/intent/src/feedback.ts index 6ee42cae..0808b11a 100644 --- a/packages/intent/src/feedback.ts +++ b/packages/intent/src/feedback.ts @@ -7,6 +7,8 @@ import type { MetaFeedbackPayload, } from './types.js' +const META_FEEDBACK_REPO = 'TanStack/intent' + // --------------------------------------------------------------------------- // Secret detection // --------------------------------------------------------------------------- @@ -326,7 +328,6 @@ export function submitFeedback( export function submitMetaFeedback( payload: MetaFeedbackPayload, - repo: string, opts: { ghAvailable: boolean; outputPath?: string }, ): SubmitResult { const md = metaToMarkdown(payload) @@ -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 @@ -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, }) @@ -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': diff --git a/packages/intent/tests/meta-feedback.test.ts b/packages/intent/tests/meta-feedback.test.ts index 68895550..54227cc3 100644 --- a/packages/intent/tests/meta-feedback.test.ts +++ b/packages/intent/tests/meta-feedback.test.ts @@ -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, }) @@ -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')