Skip to content

Commit 835d2f0

Browse files
CopilotEMaher
andauthored
feat: add Copilot prompt for Azure DevOps identity setup in apiops init
Generates .azdo/prompts/apiops-setup-identity.prompt.md when running `apiops init --ci azure-devops`, giving users an interactive guided experience via VS Code + GitHub Copilot (bash-only, no PowerShell). - New identity-setup-azdo-prompt.ts template with 10 steps covering SP creation, service connections, variable groups, environments, pipeline permissions, and pipeline creation - init-service.ts: generate prompt file and detect conflicts for AzDo - 29 new unit tests for the AzDo prompt template - 1 new test in init-service.test.ts verifying prompt file generation Agent-Logs-Url: https://github.com/Azure/apiops-cli/sessions/d8ff5b27-e09e-453a-9e87-f535044f8e0b Co-authored-by: EMaher <9244742+EMaher@users.noreply.github.com>
1 parent baadec5 commit 835d2f0

4 files changed

Lines changed: 663 additions & 0 deletions

File tree

‎src/services/init-service.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ import { generateFilterConfig } from '../templates/configs/filter-config.js';
3030
import { generateOverrideConfig } from '../templates/configs/override-config.js';
3131
import { generatePackageJson } from '../templates/configs/package-json.js';
3232
import { generateIdentitySetupPrompt } from '../templates/copilot/identity-setup-prompt.js';
33+
import {
34+
generateIdentitySetupAzdoPrompt,
35+
IdentitySetupAzdoPromptConfig,
36+
} from '../templates/copilot/identity-setup-azdo-prompt.js';
3337

3438
/** Placeholder values used in generated identity setup guides */
3539
const PLACEHOLDER_SUBSCRIPTION_ID = '<your-subscription-id>';
@@ -174,6 +178,10 @@ class InitServiceImpl implements InitService {
174178
config.outputDir,
175179
'IDENTITY-SETUP-AZDO.md'
176180
);
181+
const promptFile = path.join(
182+
config.outputDir,
183+
'.azdo/prompts/apiops-setup-identity.prompt.md'
184+
);
177185

178186
if (await this.fileExists(extractPipeline)) {
179187
conflictingFiles.push(extractPipeline);
@@ -184,6 +192,9 @@ class InitServiceImpl implements InitService {
184192
if (await this.fileExists(identityGuide)) {
185193
conflictingFiles.push(identityGuide);
186194
}
195+
if (await this.fileExists(promptFile)) {
196+
conflictingFiles.push(promptFile);
197+
}
187198
}
188199

189200
// Check for package.json
@@ -352,6 +363,17 @@ class InitServiceImpl implements InitService {
352363
const publishPath = path.join(pipelinesDir, 'run-apim-publisher.yml');
353364
await fs.writeFile(publishPath, publishContent);
354365
generatedFiles.pipelines.push('.azdo/pipelines/run-apim-publisher.yml');
366+
367+
// Copilot identity setup prompt — goes in .azdo/prompts/
368+
const azdoPromptConfig: IdentitySetupAzdoPromptConfig = {
369+
environments: config.environments,
370+
};
371+
const azdoPromptContent = generateIdentitySetupAzdoPrompt(azdoPromptConfig);
372+
const azdoPromptsDir = path.join(config.outputDir, '.azdo/prompts');
373+
await fs.mkdir(azdoPromptsDir, { recursive: true });
374+
const azdoPromptPath = path.join(azdoPromptsDir, 'apiops-setup-identity.prompt.md');
375+
await fs.writeFile(azdoPromptPath, azdoPromptContent);
376+
generatedFiles.configs.push('.azdo/prompts/apiops-setup-identity.prompt.md');
355377
}
356378

357379
/**

0 commit comments

Comments
 (0)