apiops init: generate a Copilot prompt file to audit artifacts against APIM best practices
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 55/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- azure, typescript
调研方向
从 src/templates/copilot/identity-setup-prompt.ts 和 src/services/init-service.ts 开始,按照现有的 prompt 生成模式进行了解。然后检查 src/commands/init-command.ts,查看后续步骤的输出以及 generatedFiles.configs 的处理方式。当 apiops init 能够在 identity prompt 旁生成新的 prompt,并且聚焦的 artifact audit 从查找 policy.xml 中硬编码的 secrets 开始并提供修复方案时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Problem or use case
After apiops extract, users have no guided way to check their extracted APIM artifacts against APIM best practices. The audit should look for anti-patterns (e.g. named values holding secrets that aren''t marked secret) that otherwise go unnoticed. We want a low-friction, Copilot-assisted audit that also offers to fix the issues it finds.
Proposed solution
Have apiops init generate an additional Copilot prompt file — e.g. .github/prompts/apiops-check-best-practices.prompt.md — following the same generation pattern as the existing identity-setup prompt (src/templates/copilot/identity-setup-prompt.ts, written in src/services/init-service.ts). When opened with GitHub Copilot, the prompt guides the user through auditing the artifacts in the repo against a focused set of APIM best practices.
Scope — only things apiops-cli tracks
Keep the checks centered on apiops-managed artifacts (policies, named values, backends, diagnostics/loggers, subscriptions, products). Explicitly out of scope: infra/SKU/networking/scale guidance from the WAF doc that doesn''t map to apiops artifacts.
Checks (initial set)
- Hardcoded secrets in
policy.xml(headline check) — detect literal secrets in policy XML (set-headerauth/keys,set-query-parametercode/sig,authentication-basicpassword,validate-jwtkeys, connection-string fragments).- Offer to fix: create a (secret) named value for the secret and rewrite the policy to reference it via
{{named-value}}, per https://learn.microsoft.com/en-us/azure/api-management/api-management-howto-properties
- Offer to fix: create a (secret) named value for the secret and rewrite the policy to reference it via
- Named values holding secrets that aren''t marked
secret: trueor aren''t Key Vault–backed → flag and offer to mark/migrate. - Backend URLs / keys inlined in policies instead of using named values/backends → suggest parameterizing.
(Start with check #1; #2–#3 can follow.)
Reference
APIM best-practice guidance: https://learn.microsoft.com/en-us/azure/well-architected/service-guides/azure-api-management — used as a source, but the prompt should distill only the artifact-level items above rather than the full large-deployment guidance.
Affected command
apiops init (generates the prompt file); the prompt itself assists with apiops extract output.
Implementation notes
- New template under
src/templates/copilot/(e.g.best-practices-prompt.ts) + embedded markdown, mirroringidentity-setup-prompt.ts. - Write the file in
init-service.tsalongside the identity prompt (conflict-check + add togeneratedFiles.configs), and mention it in theinit-command.tsnext-steps output. - Relates to #198 (the CLI-side redact-and-warn for the same class of issue; this prompt is the interactive remediation counterpart).
- 主要语言
- TypeScript
- 星标
- 29
- 派生
- 10
- 平均合并
- 1 天 13 小时
- 30 天内合并 PR
- 23
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Azure/apiops-cli 的其他 Issue
-
type:question
难度 2/5 1-3 小时 新手友好度 76/100
Azure/apiops-cli#277 ·
-
type:documentation
难度 1/5 1 小时以内 新手友好度 94/100
Azure/apiops-cli#250 ·
-
Documentation P2
难度 2/5 1-3 小时 新手友好度 70/100
Azure/apiops-cli#24 · 1 条评论 ·
-
type:bug
难度 3/5 1-2 天 新手友好度 68/100
Azure/apiops-cli#294 ·
-
type:bug
难度 4/5 3-5 天 新手友好度 55/100
Azure/apiops-cli#291 ·
相似的 Issue
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs 未关闭
难度 2/5 1-3 小时 新手友好度 70/100
-
Crush 未关闭
难度 1/5 1 小时以内 新手友好度 85/100
catppuccin/catppuccin#3125 ·
-
难度 1/5 1 小时以内 新手友好度 90/100
ElementsProject/cln-application#167 · 1 条评论 · 1 个 reaction ·
-
难度 2/5 1-3 小时 新手友好度 75/100
Quantco/pnpm-licenses#17 ·
-
难度 2/5 1-3 小时 新手友好度 75/100