@peterhauge/apiops-cli 0.3.0-alpha.0 → 0.4.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/CHANGELOG.md +166 -0
  2. package/README.md +6 -0
  3. package/dist/cli/init-command.js +5 -5
  4. package/dist/cli/init-command.js.map +1 -1
  5. package/dist/lib/render-template.d.ts +10 -0
  6. package/dist/lib/render-template.d.ts.map +1 -0
  7. package/dist/lib/render-template.js +14 -0
  8. package/dist/lib/render-template.js.map +1 -0
  9. package/dist/services/api-extractor.d.ts.map +1 -1
  10. package/dist/services/api-extractor.js +10 -6
  11. package/dist/services/api-extractor.js.map +1 -1
  12. package/dist/services/extract-service.d.ts.map +1 -1
  13. package/dist/services/extract-service.js +4 -2
  14. package/dist/services/extract-service.js.map +1 -1
  15. package/dist/services/identity-guide-service.d.ts +3 -4
  16. package/dist/services/identity-guide-service.d.ts.map +1 -1
  17. package/dist/services/identity-guide-service.js +6 -40
  18. package/dist/services/identity-guide-service.js.map +1 -1
  19. package/dist/services/init-service.d.ts.map +1 -1
  20. package/dist/services/init-service.js +61 -28
  21. package/dist/services/init-service.js.map +1 -1
  22. package/dist/services/product-extractor.d.ts.map +1 -1
  23. package/dist/services/product-extractor.js +4 -2
  24. package/dist/services/product-extractor.js.map +1 -1
  25. package/dist/services/publish-service.d.ts.map +1 -1
  26. package/dist/services/publish-service.js +30 -0
  27. package/dist/services/publish-service.js.map +1 -1
  28. package/dist/services/resource-publisher.d.ts +5 -0
  29. package/dist/services/resource-publisher.d.ts.map +1 -1
  30. package/dist/services/resource-publisher.js +15 -1
  31. package/dist/services/resource-publisher.js.map +1 -1
  32. package/dist/services/secret-redaction-guard.d.ts +40 -0
  33. package/dist/services/secret-redaction-guard.d.ts.map +1 -0
  34. package/dist/services/secret-redaction-guard.js +92 -0
  35. package/dist/services/secret-redaction-guard.js.map +1 -0
  36. package/dist/services/secret-redactor.d.ts +18 -0
  37. package/dist/services/secret-redactor.d.ts.map +1 -1
  38. package/dist/services/secret-redactor.js +172 -0
  39. package/dist/services/secret-redactor.js.map +1 -1
  40. package/dist/templates/azure-devops/publish-pipeline.d.ts.map +1 -1
  41. package/dist/templates/azure-devops/publish-pipeline.js +62 -28
  42. package/dist/templates/azure-devops/publish-pipeline.js.map +1 -1
  43. package/dist/templates/configs/filter-config.d.ts.map +1 -1
  44. package/dist/templates/configs/filter-config.js +6 -118
  45. package/dist/templates/configs/filter-config.js.map +1 -1
  46. package/dist/templates/configs/override-config.d.ts.map +1 -1
  47. package/dist/templates/configs/override-config.js +7 -92
  48. package/dist/templates/configs/override-config.js.map +1 -1
  49. package/dist/templates/configs/schema-ref.d.ts +18 -0
  50. package/dist/templates/configs/schema-ref.d.ts.map +1 -0
  51. package/dist/templates/configs/schema-ref.js +26 -0
  52. package/dist/templates/configs/schema-ref.js.map +1 -0
  53. package/dist/templates/copilot/configure-filter-prompt.d.ts +10 -0
  54. package/dist/templates/copilot/configure-filter-prompt.d.ts.map +1 -0
  55. package/dist/templates/copilot/configure-filter-prompt.js +14 -0
  56. package/dist/templates/copilot/configure-filter-prompt.js.map +1 -0
  57. package/dist/templates/copilot/configure-overrides-prompt.d.ts +7 -0
  58. package/dist/templates/copilot/configure-overrides-prompt.d.ts.map +1 -0
  59. package/dist/templates/copilot/configure-overrides-prompt.js +12 -0
  60. package/dist/templates/copilot/configure-overrides-prompt.js.map +1 -0
  61. package/dist/templates/copilot/identity-setup-prompt.d.ts.map +1 -1
  62. package/dist/templates/copilot/identity-setup-prompt.js +19 -24
  63. package/dist/templates/copilot/identity-setup-prompt.js.map +1 -1
  64. package/dist/templates/generated/embedded-markdown.d.ts +8 -5
  65. package/dist/templates/generated/embedded-markdown.d.ts.map +1 -1
  66. package/dist/templates/generated/embedded-markdown.js +8 -5
  67. package/dist/templates/generated/embedded-markdown.js.map +1 -1
  68. package/dist/templates/github-actions/extract-workflow.js +4 -4
  69. package/dist/templates/github-actions/publish-workflow.d.ts +2 -1
  70. package/dist/templates/github-actions/publish-workflow.d.ts.map +1 -1
  71. package/dist/templates/github-actions/publish-workflow.js +103 -78
  72. package/dist/templates/github-actions/publish-workflow.js.map +1 -1
  73. package/package.json +8 -5
@@ -4,124 +4,12 @@
4
4
  * Sample filter configuration template
5
5
  * Generates a sample configuration.extractor.yaml file
6
6
  */
7
+ import { filterConfigTemplate } from '../generated/embedded-markdown.js';
8
+ import { renderTemplate } from '../../lib/render-template.js';
9
+ import { schemaUrl } from './schema-ref.js';
7
10
  export function generateFilterConfig() {
8
- return `# APIM Extract Filter Configuration
9
- # Customize this file to control which resources are extracted
10
- # For full format details and examples, see:
11
- # https://github.com/Azure/apiops-cli/blob/main/docs/guides/filtering-resources.md
12
-
13
- # Extract only specific APIs by name (or wildcard pattern)
14
- # apis:
15
- # - echo-api
16
- # - petstore-api
17
- # - 'prod-*' # Wildcard: all APIs starting with prod-
18
- # - '*-internal-*' # Wildcard: all APIs containing -internal-
19
-
20
- # Advanced: Filter API sub-resources (operations, diagnostics, schemas, releases)
21
- # apis:
22
- # - echo-api # Include all sub-resources
23
- # - petstore-api: # Control sub-resources
24
- # operations:
25
- # - get-pets
26
- # - create-pet
27
- # - 'list-*' # Wildcard: all operations starting with list-
28
- # diagnostics:
29
- # - applicationinsights
30
- # schemas: [] # Exclude all schemas
31
- # releases:
32
- # - v1
33
-
34
- # Extract only specific products
35
- # products:
36
- # - starter
37
- # - unlimited
38
-
39
- # Extract only specific backends
40
- # backends:
41
- # - backend-api
42
- # - legacy-backend
43
-
44
- # Extract only specific named values
45
- # namedValues:
46
- # - api-key
47
- # - connection-string
48
-
49
- # Extract only specific loggers
50
- # loggers:
51
- # - appinsights-logger
52
-
53
- # Extract only specific diagnostics
54
- # diagnostics:
55
- # - applicationinsights
56
-
57
- # Extract only specific tags
58
- # tags:
59
- # - production
60
- # - external
61
-
62
- # Extract only specific policy fragments
63
- # policyFragments:
64
- # - rate-limit-fragment
65
- # - cors-fragment
66
-
67
- # Extract only specific gateways
68
- # gateways:
69
- # - default
70
- # - internal-gateway
71
-
72
- # Extract only specific version sets
73
- # versionSets:
74
- # - payments-v1
75
-
76
- # Extract only specific groups
77
- # groups:
78
- # - administrators
79
-
80
- # Extract only specific subscriptions
81
- # subscriptions:
82
- # - starter-subscription
83
-
84
- # Extract only specific schemas
85
- # schemas:
86
- # - pet-schema
87
-
88
- # Filter service-level policies
89
- # policies:
90
- # - policy
91
-
92
- # Extract only specific policy restrictions
93
- # policyRestrictions:
94
- # - global-policy-restriction
95
-
96
- # Extract only specific documentations
97
- # documentations:
98
- # - getting-started
99
-
100
- # Extract only specific workspaces
101
- # workspaces:
102
- # - dev-workspace
103
-
104
- # Advanced: Filter workspace sub-resources
105
- # workspaces:
106
- # - team-workspace:
107
- # apis:
108
- # - team-api-1
109
- # - team-api-2
110
- # backends:
111
- # - team-backend
112
- # namedValues:
113
- # - team-api-key
114
-
115
- # Filter behavior:
116
- # - Leave a section commented out to include ALL resources of that type
117
- # - Set a section to an empty array ([]) to exclude ALL resources of that type
118
- # Example:
119
- # gateways: []
120
- # subscriptions: []
121
- # - Use * to match any characters: prod-* matches prod-api, prod-users
122
- # - Use ? to match a single character: api-v? matches api-v1, api-v2
123
- # - Exact names and wildcard patterns can be mixed in the same list
124
- # - All matching is case-insensitive
125
- `;
11
+ return renderTemplate(filterConfigTemplate, {
12
+ SCHEMA_URL: schemaUrl('extractor-config.schema.json'),
13
+ });
126
14
  }
127
15
  //# sourceMappingURL=filter-config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter-config.js","sourceRoot":"","sources":["../../../src/templates/configs/filter-config.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC;;;GAGG;AAEH,MAAM,UAAU,oBAAoB;IAClC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqHR,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"filter-config.js","sourceRoot":"","sources":["../../../src/templates/configs/filter-config.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,UAAU,oBAAoB;IAClC,OAAO,cAAc,CAAC,oBAAoB,EAAE;QAC1C,UAAU,EAAE,SAAS,CAAC,8BAA8B,CAAC;KACtD,CAAC,CAAC;AACL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"override-config.d.ts","sourceRoot":"","sources":["../../../src/templates/configs/override-config.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAEH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA6FlE"}
1
+ {"version":3,"file":"override-config.d.ts","sourceRoot":"","sources":["../../../src/templates/configs/override-config.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAMH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAKlE"}
@@ -4,98 +4,13 @@
4
4
  * Sample override configuration template per environment
5
5
  * Generates environment-specific configuration.{env}.yaml files
6
6
  */
7
+ import { overrideConfigTemplate } from '../generated/embedded-markdown.js';
8
+ import { renderTemplate } from '../../lib/render-template.js';
9
+ import { schemaUrl } from './schema-ref.js';
7
10
  export function generateOverrideConfig(environment) {
8
- return `# APIM Override Configuration for ${environment} environment
9
- # Customize resource properties for this specific environment
10
- # For full format details and examples, see:
11
- # https://github.com/Azure/apiops-cli/blob/main/docs/guides/environment-overrides.md
12
-
13
- # Override named values (e.g., API keys, connection strings)
14
- # namedValues:
15
- # - name: api-key
16
- # properties:
17
- # value: "${environment}-api-key-value"
18
- # - name: connection-string
19
- # properties:
20
- # value: "{#[DB_Connection_String]#}"
21
- # - name: secret-from-keyvault
22
- # properties:
23
- # keyVault:
24
- # secretIdentifier: "https://${environment}-kv.vault.azure.net/secrets/my-secret"
25
- # identityClientId: "00000000-0000-0000-0000-000000000000"
26
-
27
- # Override backend URLs per environment
28
- # backends:
29
- # - name: backend-api
30
- # properties:
31
- # url: "https://${environment}-api.example.com"
32
- # - name: legacy-backend
33
- # properties:
34
- # url: "https://${environment}-legacy.example.com"
35
- # resourceId: "/subscriptions/.../sites/${environment}-backend"
36
-
37
- # Override API service URLs (with optional nested sub-resource overrides)
38
- # apis:
39
- # - name: echo-api
40
- # properties:
41
- # serviceUrl: "https://${environment}-echo.example.com"
42
- # - name: petstore-api
43
- # properties:
44
- # serviceUrl: "https://${environment}-petstore.example.com"
45
- # displayName: "Petstore API (${environment})"
46
- # diagnostics:
47
- # - name: applicationinsights
48
- # properties:
49
- # loggerId: "appinsights-logger-${environment}"
50
- # verbosity: Error
51
- # policies:
52
- # - name: policy
53
- # properties:
54
- # format: rawxml
55
-
56
- # Override diagnostic logger references
57
- # diagnostics:
58
- # - name: applicationinsights
59
- # properties:
60
- # loggerId: "appinsights-logger-${environment}"
61
- # verbosity: Error
62
-
63
- # Override logger credentials or resource IDs
64
- # loggers:
65
- # - name: appinsights-logger
66
- # properties:
67
- # loggerType: applicationInsights
68
- # resourceId: "/subscriptions/xxxxx/resourceGroups/${environment}-rg/providers/microsoft.insights/components/${environment}-appinsights"
69
- # isBuffered: true
70
- # credentials:
71
- # instrumentationKey: "<APP-INSIGHTS-INSTRUMENTATION-KEY>"
72
-
73
- # Override service-level policies
74
- # policies:
75
- # - name: policy
76
- # properties:
77
- # format: rawxml
78
-
79
- # Override gateway properties
80
- # gateways:
81
- # - name: on-prem-gateway
82
- # properties:
83
- # locationData:
84
- # name: "${environment} datacenter"
85
-
86
- # Override version sets, groups, subscriptions, products, tags, policy fragments
87
- # versionSets:
88
- # - name: my-version-set
89
- # properties:
90
- # displayName: "My Version Set (${environment})"
91
- # products:
92
- # - name: starter
93
- # properties:
94
- # displayName: "Starter Plan (${environment})"
95
- # tags:
96
- # - name: env-tag
97
- # properties:
98
- # displayName: "${environment}"
99
- `;
11
+ return renderTemplate(overrideConfigTemplate, {
12
+ SCHEMA_URL: schemaUrl('override-config.schema.json'),
13
+ ENVIRONMENT: environment,
14
+ });
100
15
  }
101
16
  //# sourceMappingURL=override-config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"override-config.js","sourceRoot":"","sources":["../../../src/templates/configs/override-config.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC;;;GAGG;AAEH,MAAM,UAAU,sBAAsB,CAAC,WAAmB;IACxD,OAAO,qCAAqC,WAAW;;;;;;;;;kBASvC,WAAW;;;;;;;uCAOU,WAAW;;;;;;;wBAO1B,WAAW;;;wBAGX,WAAW;gDACa,WAAW;;;;;;+BAM5B,WAAW;;;+BAGX,WAAW;sCACJ,WAAW;;;;4CAIL,WAAW;;;;;;;;;;;wCAWf,WAAW;;;;;;;;2DAQQ,WAAW,+CAA+C,WAAW;;;;;;;;;;;;;;;;mBAgB7G,WAAW;;;;;;wCAMU,WAAW;;;;sCAIb,WAAW;;;;wBAIzB,WAAW;CAClC,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"override-config.js","sourceRoot":"","sources":["../../../src/templates/configs/override-config.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,MAAM,UAAU,sBAAsB,CAAC,WAAmB;IACxD,OAAO,cAAc,CAAC,sBAAsB,EAAE;QAC5C,UAAU,EAAE,SAAS,CAAC,6BAA6B,CAAC;QACpD,WAAW,EAAE,WAAW;KACzB,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Builds URLs to the published JSON schemas.
3
+ *
4
+ * The schema is only an editor/IDE validation aid (yaml-language-server); the
5
+ * CLI does its own validation at runtime. Schemas are versioned independently
6
+ * of the CLI package version: each schema version lives at a frozen path
7
+ * (`schemas/v<N>/...`) on the `main` branch. Backward-compatible edits update
8
+ * the current version in place; a breaking change introduces a new version
9
+ * folder. The `main` ref always resolves, and the versioned path keeps existing
10
+ * config files pointing at the schema shape they were written against.
11
+ */
12
+ /**
13
+ * Returns the raw URL for a published schema file at the current schema version.
14
+ *
15
+ * @param fileName Schema file name, e.g. `extractor-config.schema.json`.
16
+ */
17
+ export declare function schemaUrl(fileName: string): string;
18
+ //# sourceMappingURL=schema-ref.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-ref.d.ts","sourceRoot":"","sources":["../../../src/templates/configs/schema-ref.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAMH;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIlD"}
@@ -0,0 +1,26 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ /**
4
+ * Builds URLs to the published JSON schemas.
5
+ *
6
+ * The schema is only an editor/IDE validation aid (yaml-language-server); the
7
+ * CLI does its own validation at runtime. Schemas are versioned independently
8
+ * of the CLI package version: each schema version lives at a frozen path
9
+ * (`schemas/v<N>/...`) on the `main` branch. Backward-compatible edits update
10
+ * the current version in place; a breaking change introduces a new version
11
+ * folder. The `main` ref always resolves, and the versioned path keeps existing
12
+ * config files pointing at the schema shape they were written against.
13
+ */
14
+ import packageJson from '../../../package.json' with { type: 'json' };
15
+ const SCHEMA_BASE = 'https://raw.githubusercontent.com/Azure/apiops-cli/main/schemas';
16
+ /**
17
+ * Returns the raw URL for a published schema file at the current schema version.
18
+ *
19
+ * @param fileName Schema file name, e.g. `extractor-config.schema.json`.
20
+ */
21
+ export function schemaUrl(fileName) {
22
+ const { schemaVersion } = packageJson;
23
+ const version = schemaVersion ?? '1';
24
+ return `${SCHEMA_BASE}/v${version}/${fileName}`;
25
+ }
26
+ //# sourceMappingURL=schema-ref.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-ref.js","sourceRoot":"","sources":["../../../src/templates/configs/schema-ref.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC;;;;;;;;;;GAUG;AAEH,OAAO,WAAW,MAAM,uBAAuB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAEtE,MAAM,WAAW,GAAG,iEAAiE,CAAC;AAEtF;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,QAAgB;IACxC,MAAM,EAAE,aAAa,EAAE,GAAG,WAAyC,CAAC;IACpE,MAAM,OAAO,GAAG,aAAa,IAAI,GAAG,CAAC;IACrC,OAAO,GAAG,WAAW,KAAK,OAAO,IAAI,QAAQ,EAAE,CAAC;AAClD,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * GitHub Copilot prompt template for configuring resource filters.
3
+ * Generates a .prompt.md file that guides Copilot through creating
4
+ * a configuration.extractor.yaml filter file.
5
+ */
6
+ export interface ConfigureFilterPromptConfig {
7
+ environments: string[];
8
+ }
9
+ export declare function generateConfigureFilterPrompt(_config: ConfigureFilterPromptConfig): string;
10
+ //# sourceMappingURL=configure-filter-prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure-filter-prompt.d.ts","sourceRoot":"","sources":["../../../src/templates/copilot/configure-filter-prompt.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAIH,MAAM,WAAW,2BAA2B;IAC1C,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,2BAA2B,GAAG,MAAM,CAI1F"}
@@ -0,0 +1,14 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ /**
4
+ * GitHub Copilot prompt template for configuring resource filters.
5
+ * Generates a .prompt.md file that guides Copilot through creating
6
+ * a configuration.extractor.yaml filter file.
7
+ */
8
+ import { copilotConfigureFilterPromptTemplate } from '../generated/embedded-markdown.js';
9
+ export function generateConfigureFilterPrompt(_config) {
10
+ // The filter prompt is static — no token substitution needed currently.
11
+ // The config parameter is accepted for future extensibility and consistency.
12
+ return copilotConfigureFilterPromptTemplate;
13
+ }
14
+ //# sourceMappingURL=configure-filter-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure-filter-prompt.js","sourceRoot":"","sources":["../../../src/templates/copilot/configure-filter-prompt.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC;;;;GAIG;AAEH,OAAO,EAAE,oCAAoC,EAAE,MAAM,mCAAmC,CAAC;AAMzF,MAAM,UAAU,6BAA6B,CAAC,OAAoC;IAChF,wEAAwE;IACxE,6EAA6E;IAC7E,OAAO,oCAAoC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * GitHub Copilot prompt template for configuring environment overrides.
3
+ * Generates a .prompt.md file that guides Copilot through creating
4
+ * configuration.{env}.yaml override files for environment promotion.
5
+ */
6
+ export declare function generateConfigureOverridesPrompt(): string;
7
+ //# sourceMappingURL=configure-overrides-prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure-overrides-prompt.d.ts","sourceRoot":"","sources":["../../../src/templates/copilot/configure-overrides-prompt.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAIH,wBAAgB,gCAAgC,IAAI,MAAM,CAEzD"}
@@ -0,0 +1,12 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ /**
4
+ * GitHub Copilot prompt template for configuring environment overrides.
5
+ * Generates a .prompt.md file that guides Copilot through creating
6
+ * configuration.{env}.yaml override files for environment promotion.
7
+ */
8
+ import { copilotConfigureOverridesPromptTemplate } from '../generated/embedded-markdown.js';
9
+ export function generateConfigureOverridesPrompt() {
10
+ return copilotConfigureOverridesPromptTemplate;
11
+ }
12
+ //# sourceMappingURL=configure-overrides-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure-overrides-prompt.js","sourceRoot":"","sources":["../../../src/templates/copilot/configure-overrides-prompt.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC;;;;GAIG;AAEH,OAAO,EAAE,uCAAuC,EAAE,MAAM,mCAAmC,CAAC;AAE5F,MAAM,UAAU,gCAAgC;IAC9C,OAAO,uCAAuC,CAAC;AACjD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"identity-setup-prompt.d.ts","sourceRoot":"","sources":["../../../src/templates/copilot/identity-setup-prompt.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAUH,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,gBAAgB,GAAG,cAAc,CAAC;CAChD;AASD,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,yBAAyB,GAAG,MAAM,CAkFrF"}
1
+ {"version":3,"file":"identity-setup-prompt.d.ts","sourceRoot":"","sources":["../../../src/templates/copilot/identity-setup-prompt.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAUH,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,gBAAgB,GAAG,cAAc,CAAC;CAChD;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,yBAAyB,GAAG,MAAM,CA8ErF"}
@@ -8,10 +8,8 @@
8
8
  * 3. Assigning RBAC roles
9
9
  * 4. Completing provider-specific setup tasks
10
10
  */
11
- import { azureDevOpsIdentitySetupCoreTemplate, copilotAzureDevOpsIdentitySetupPromptTemplate, copilotGithubEnvironmentFederatedCredentialTemplate, copilotGithubEnvironmentSecretCommandsTemplate, copilotGitHubActionsIdentitySetupPromptTemplate, } from '../generated/embedded-markdown.js';
12
- function renderTemplate(template, tokens) {
13
- return Object.entries(tokens).reduce((rendered, [key, value]) => rendered.replaceAll(`{{${key}}}`, value), template);
14
- }
11
+ import { copilotAzureDevOpsIdentitySetupPromptTemplate, copilotGithubEnvironmentFederatedCredentialTemplate, copilotGithubEnvironmentSecretCommandsTemplate, copilotGitHubActionsIdentitySetupPromptTemplate, } from '../generated/embedded-markdown.js';
12
+ import { renderTemplate } from '../../lib/render-template.js';
15
13
  export function generateIdentitySetupPrompt(config) {
16
14
  if (config.ciProvider === 'azure-devops') {
17
15
  const environmentsArrayPowerShell = config.environments
@@ -20,16 +18,13 @@ export function generateIdentitySetupPrompt(config) {
20
18
  const environmentsArrayBash = config.environments
21
19
  .map((environment) => `"${environment}"`)
22
20
  .join(' ');
23
- const coreSteps = renderTemplate(azureDevOpsIdentitySetupCoreTemplate, {
21
+ return renderTemplate(copilotAzureDevOpsIdentitySetupPromptTemplate, {
24
22
  ENVIRONMENTS_ARRAY_POWERSHELL: environmentsArrayPowerShell,
25
23
  ENVIRONMENTS_ARRAY_BASH: environmentsArrayBash,
26
24
  });
27
- return renderTemplate(copilotAzureDevOpsIdentitySetupPromptTemplate, {
28
- AZURE_DEVOPS_CORE_STEPS: coreSteps,
29
- });
30
25
  }
31
- const envSecrets = config.environments.map((env) => `- \`AZURE_SUBSCRIPTION_ID\` — Azure subscription ID for **${env}** environment
32
- - \`APIM_RESOURCE_GROUP_${env.toUpperCase()}\` — Resource group containing the **${env}** APIM instance
26
+ const envSecrets = config.environments.map((env) => `- \`AZURE_SUBSCRIPTION_ID\` — Azure subscription ID for **${env}** environment
27
+ - \`APIM_RESOURCE_GROUP_${env.toUpperCase()}\` — Resource group containing the **${env}** APIM instance
33
28
  - \`APIM_SERVICE_NAME_${env.toUpperCase()}\` — APIM service name for **${env}**`).join('\n');
34
29
  const envFedCreds = config.environments.map((env) => renderTemplate(copilotGithubEnvironmentFederatedCredentialTemplate, {
35
30
  ENV: env,
@@ -38,24 +33,24 @@ export function generateIdentitySetupPrompt(config) {
38
33
  ENV: env,
39
34
  ENV_UPPER: env.toUpperCase(),
40
35
  })).join('\n\n');
41
- const environmentCreationCommands = config.environments.map((env) => `# Create the ${env} environment (requires GitHub CLI)
36
+ const environmentCreationCommands = config.environments.map((env) => `# Create the ${env} environment (requires GitHub CLI)
42
37
  gh api --method PUT "repos/\${GITHUB_ORG}/\${GITHUB_REPO}/environments/${env}"`).join('\n\n');
43
38
  const envSubscriptionTableRows = config.environments.map((env) => `| \`AZURE_SUBSCRIPTION_ID_${env.toUpperCase()}\` | Azure subscription ID for **${env}** environment | \`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\` |`).join('\n');
44
- const envApimTableRows = config.environments.map((env) => `| \`APIM_RG_${env.toUpperCase()}\` | Resource group for **${env}** APIM instance | \`rg-apim-${env}\` |
39
+ const envApimTableRows = config.environments.map((env) => `| \`APIM_RG_${env.toUpperCase()}\` | Resource group for **${env}** APIM instance | \`rg-apim-${env}\` |
45
40
  | \`APIM_NAME_${env.toUpperCase()}\` | APIM service name for **${env}** | \`apim-${env}\` |`).join('\n');
46
- const envReaderRoleSnippets = config.environments.map((env) => `\`\`\`bash
47
- # Reader role for ${env} resource group
48
- az role assignment create \\
49
- --assignee "$APP_ID" \\
50
- --role "Reader" \\
51
- --scope "/subscriptions/\${AZURE_SUBSCRIPTION_ID_${env.toUpperCase()}}/resourceGroups/\${APIM_RG_${env.toUpperCase()}}"
41
+ const envReaderRoleSnippets = config.environments.map((env) => `\`\`\`bash
42
+ # Reader role for ${env} resource group
43
+ az role assignment create \\
44
+ --assignee "$APP_ID" \\
45
+ --role "Reader" \\
46
+ --scope "/subscriptions/\${AZURE_SUBSCRIPTION_ID_${env.toUpperCase()}}/resourceGroups/\${APIM_RG_${env.toUpperCase()}}"
52
47
  \`\`\``).join('\n\n');
53
- const envApimRoleSnippets = config.environments.map((env) => `\`\`\`bash
54
- # Assign role for ${env} environment
55
- az role assignment create \\
56
- --assignee "$APP_ID" \\
57
- --role "API Management Service Contributor" \\
58
- --scope "/subscriptions/\${AZURE_SUBSCRIPTION_ID_${env.toUpperCase()}}/resourceGroups/\${APIM_RG_${env.toUpperCase()}}/providers/Microsoft.ApiManagement/service/\${APIM_NAME_${env.toUpperCase()}}"
48
+ const envApimRoleSnippets = config.environments.map((env) => `\`\`\`bash
49
+ # Assign role for ${env} environment
50
+ az role assignment create \\
51
+ --assignee "$APP_ID" \\
52
+ --role "API Management Service Contributor" \\
53
+ --scope "/subscriptions/\${AZURE_SUBSCRIPTION_ID_${env.toUpperCase()}}/resourceGroups/\${APIM_RG_${env.toUpperCase()}}/providers/Microsoft.ApiManagement/service/\${APIM_NAME_${env.toUpperCase()}}"
59
54
  \`\`\``).join('\n\n');
60
55
  return renderTemplate(copilotGitHubActionsIdentitySetupPromptTemplate, {
61
56
  ENV_SECRETS_REFERENCE: envSecrets,
@@ -1 +1 @@
1
- {"version":3,"file":"identity-setup-prompt.js","sourceRoot":"","sources":["../../../src/templates/copilot/identity-setup-prompt.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC;;;;;;;GAOG;AAEH,OAAO,EACL,oCAAoC,EACpC,6CAA6C,EAC7C,mDAAmD,EACnD,8CAA8C,EAC9C,+CAA+C,GAChD,MAAM,mCAAmC,CAAC;AAO3C,SAAS,cAAc,CAAC,QAAgB,EAAE,MAA8B;IACtE,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAClC,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,GAAG,IAAI,EAAE,KAAK,CAAC,EACpE,QAAQ,CACT,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,MAAiC;IAC3E,IAAI,MAAM,CAAC,UAAU,KAAK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