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
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
const decisionsProvider = new DecisionsTreeProvider(dataProvider, squadFolderName);

// Wire up GitHub Issues service
const issuesService = new GitHubIssuesService();
const issuesService = new GitHubIssuesService({ squadFolder: squadFolderName });
teamProvider.setIssuesService(issuesService);

// Create dashboard webview
Expand Down Expand Up @@ -201,7 +201,7 @@
if (typeof rawName === 'string') {
memberName = rawName;
} else if (typeof rawName === 'object' && rawName !== null) {
memberName = String((rawName as any).label || (rawName as any).name || '');

Check warning on line 204 in src/extension.ts

View workflow job for this annotation

GitHub Actions / build-and-test (macos-latest)

Unexpected any. Specify a different type

Check warning on line 204 in src/extension.ts

View workflow job for this annotation

GitHub Actions / build-and-test (macos-latest)

Unexpected any. Specify a different type

Check warning on line 204 in src/extension.ts

View workflow job for this annotation

GitHub Actions / build-and-test (ubuntu-latest)

Unexpected any. Specify a different type

Check warning on line 204 in src/extension.ts

View workflow job for this annotation

GitHub Actions / build-and-test (ubuntu-latest)

Unexpected any. Specify a different type

Check warning on line 204 in src/extension.ts

View workflow job for this annotation

GitHub Actions / build-and-test (windows-latest)

Unexpected any. Specify a different type

Check warning on line 204 in src/extension.ts

View workflow job for this annotation

GitHub Actions / build-and-test (windows-latest)

Unexpected any. Specify a different type
}
const teamRoot = typeof rawRoot === 'string' ? rawRoot : undefined;
if (!memberName) {
Expand Down
5 changes: 4 additions & 1 deletion src/services/GitHubIssuesService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ export interface GitHubIssuesServiceOptions {

/** GitHub API base URL (default: https://api.github.com) */
apiBaseUrl?: string;

/** Squad folder name (default: '.ai-team') */
squadFolder?: '.squad' | '.ai-team';
}

/**
Expand All @@ -66,7 +69,7 @@ export class GitHubIssuesService {
private issueSourceCache: IssueSourceConfig | null = null;

constructor(options: GitHubIssuesServiceOptions = {}) {
this.teamMdService = new TeamMdService();
this.teamMdService = new TeamMdService(options.squadFolder);
this.cacheTtlMs = options.cacheTtlMs ?? DEFAULT_CACHE_TTL_MS;
this.token = options.token;
this.apiBaseUrl = (options.apiBaseUrl ?? 'https://api.github.com').replace(/\/+$/, '');
Expand Down
45 changes: 45 additions & 0 deletions src/test/suite/gitHubIssuesService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,37 @@ suite('GitHubIssuesService', () => {
}
});

test('reads team.md from .squad folder when squadFolder option is set', async () => {
const tempDir = path.join(TEST_FIXTURES_ROOT, 'temp-squad-folder');
const squadDir = path.join(tempDir, '.squad');
await fs.promises.mkdir(squadDir, { recursive: true });
await fs.promises.writeFile(path.join(squadDir, 'team.md'), [
'# Team',
'',
'## Issue Source',
'',
'| Field | Value |',
'|-------|-------|',
'| **Repository** | testowner/testrepo |',
].join('\n'));

try {
// Without squadFolder option, service looks in .ai-team (misses .squad)
const defaultService = new GitHubIssuesService();
const defaultConfig = await defaultService.getIssueSource(tempDir);
assert.strictEqual(defaultConfig, null, 'Default service should not find .squad/team.md');

// With squadFolder option, service finds team.md in .squad
const squadService = new GitHubIssuesService({ squadFolder: '.squad' });
const squadConfig = await squadService.getIssueSource(tempDir);
assert.ok(squadConfig, 'Squad service should find .squad/team.md');
assert.strictEqual(squadConfig!.owner, 'testowner');
assert.strictEqual(squadConfig!.repo, 'testrepo');
} finally {
await fs.promises.rm(tempDir, { recursive: true, force: true });
}
});

test('parses owner/repo format correctly', async () => {
const tempDir = path.join(TEST_FIXTURES_ROOT, 'temp-repo-format');
const aiTeamDir = path.join(tempDir, '.ai-team');
Expand Down Expand Up @@ -423,5 +454,19 @@ suite('GitHubIssuesService', () => {
const token = (service as unknown as { token: string }).token;
assert.strictEqual(token, 'ghp_test123');
});

test('passes squadFolder to internal TeamMdService', () => {
const service = new GitHubIssuesService({ squadFolder: '.squad' });

const teamMdService = (service as unknown as { teamMdService: { squadFolder: string } }).teamMdService;
assert.strictEqual(teamMdService.squadFolder, '.squad');
});

test('defaults to .ai-team when squadFolder not specified', () => {
const service = new GitHubIssuesService();

const teamMdService = (service as unknown as { teamMdService: { squadFolder: string } }).teamMdService;
assert.strictEqual(teamMdService.squadFolder, '.ai-team');
});
});
});
Loading