Skip to content

Commit 2a9d632

Browse files
Peter HaugeCopilot
andcommitted
chore: remove unimplemented --spec-format option
The --spec-format CLI option for extract was spec'd but never implemented. Since issue #9 has been closed without implementation, this commit removes all references from: - Source code (extract-command.ts, config.ts) - Tests (extract-command.test.ts) - Documentation (README.md, docs/commands/extract.md) - Specs (cli-commands.md, data-model.md, spec.md, research.md, tasks.md) Historical references in .squad/ decision records are preserved as they document what was intentionally not implemented. Closes #9 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ca15989 commit 2a9d632

10 files changed

Lines changed: 6 additions & 26 deletions

File tree

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ Extract APIM service configuration to local artifact files.
4747
| `--output <dir>` | `./apim-artifacts` | Output directory |
4848
| `--filter <path>` | | Extract only matching resources |
4949
| `--no-transitive` | | Skip transitive dependencies |
50-
| `--spec-format <format>` | | Override API spec format |
5150

5251
```bash
5352
apiops extract --help
@@ -58,12 +57,11 @@ apiops extract \
5857
--service-name <name> \
5958
--output ./apim-artifacts
6059

61-
# Extract a filtered subset of resources and override the API spec format
60+
# Extract a filtered subset of resources
6261
apiops extract \
6362
--resource-group <rg> \
6463
--service-name <name> \
65-
--filter ./filter.yaml \
66-
--spec-format openapi-v3-yaml
64+
--filter ./filter.yaml
6765

6866
# Authenticate explicitly with a service principal
6967
apiops extract \

docs/commands/extract.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ apiops extract \
6666
| `--output <dir>` | string | `./apim-artifacts` | No | Output directory path |
6767
| `--filter <path>` | string || No | Filter configuration YAML file |
6868
| `--no-transitive` | boolean | false (transitive ON) | No | Disable transitive dependency inclusion |
69-
| `--spec-format <format>` | string || No | API spec format: `openapi-v2-json`, `openapi-v3-json`, `openapi-v3-yaml` |
7069

7170
### Global flags
7271

specs/contracts/cli-commands.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ Extract APIM configuration to local artifact files.
3535
| `--output <dir>` | string | no | `./apim-artifacts` | Output directory path |
3636
| `--filter <path>` | string | no || Filter configuration YAML file |
3737
| `--no-transitive` | boolean | no | `false` | Disable transitive dependency inclusion |
38-
| `--spec-format <format>` | string | no || API specification format (`openapi-v2-json`, `openapi-v3-json`, `openapi-v3-yaml`); native format used when omitted or conversion not possible |
3938

4039
**stdout**: Per-resource status lines (one per extracted resource)
4140
**stderr**: Structured log messages (JSON when `--verbose`)

specs/data-model.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ interface ExtractConfig {
150150
outputDir: string;
151151
filter?: FilterConfig;
152152
includeTransitive: boolean; // Default: true; false when --no-transitive
153-
specFormat?: string; // From --spec-format; undefined = native format
154153
verbose: boolean;
155154
otelConfigPath?: string;
156155
}

specs/research.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ program.command('extract')
254254
.option('--output <dir>', 'Output directory', './apim-artifacts')
255255
.option('--filter <path>', 'Filter configuration YAML file')
256256
.option('--no-transitive', 'Disable transitive dependency inclusion')
257-
.option('--spec-format <format>', 'API specification format')
258257
.action(extractAction)
259258

260259
program.command('publish')

specs/spec.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ A platform engineer wants to capture the current state of an Azure API Managemen
3535

3636
3. **Given** the user only wants a subset of resources, **When** the user provides a filter configuration file via `--filter filter.yaml`, **Then** only the resources matching the allowlist in the configuration file are extracted, along with any resources those filtered resources transitively depend on (e.g., backends, named values, loggers referenced in policies). The user can suppress transitive inclusion with `--no-transitive`.
3737

38-
4. **Given** an APIM instance with APIs using different specification formats (OpenAPI v2/v3, GraphQL, SOAP/WSDL), **When** the user runs extract with a `--spec-format` option, **Then** API specifications are exported in the requested format where format conversion is possible, and in their native format otherwise.
39-
40-
5. **Given** an APIM instance, **When** the user runs `apiops extract --format json`, **Then** machine-readable JSON progress output is written to stdout (resource counts, file paths written) suitable for CI/CD pipeline consumption.
38+
4. **Given** an APIM instance, **When** the user runs `apiops extract --format json`, **Then** machine-readable JSON progress output is written to stdout (resource counts, file paths written) suitable for CI/CD pipeline consumption.
4139

4240
7. **Given** an APIM instance with APIs that have multiple revisions (e.g., `orders-api;rev=1`, `orders-api;rev=2`), **When** the user runs `apiops extract`, **Then** all revisions are extracted as sub-folders under the API directory, preserving revision numbers and metadata.
4341

specs/tasks.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
- [ ] T025 [US1] Implement transitive dependency resolver in src/services/transitive-resolver.ts (scan policies for named value refs \{\{name\}\}, backend refs set-backend-service, policy fragment refs include-fragment; scan apiInformation.json for apiVersionSetId; fixed-point expansion; --no-transitive bypass per research.md R4)
6969
- [ ] T026 [US1] Implement secret redaction in src/services/secret-redactor.ts (detect properties.secret === true on named values, replace properties.value with redaction marker per research.md R5)
7070
- [ ] T027 [US1] Implement workspace-scoped extraction in src/services/workspace-extractor.ts (list workspaces, extract workspace-scoped resources under workspaces/{name}/ using same resource-extractor with workspace context prefix per FR-010)
71-
- [ ] T028 [US1] Register extract command in src/cli/extract-command.ts (Commander subcommand with --resource-group, --service-name, --output, --filter, --no-transitive, --spec-format flags; wire to extract-service per contracts/cli-commands.md)
71+
- [ ] T028 [US1] Register extract command in src/cli/extract-command.ts (Commander subcommand with --resource-group, --service-name, --output, --filter, --no-transitive flags; wire to extract-service per contracts/cli-commands.md)
7272
- [ ] T029 [US1] Implement JSON output mode for extract in src/cli/extract-command.ts (--format json: machine-readable JSON to stdout with resource counts and file paths per FR-013)
7373

7474
**Checkpoint**: `apiops extract` works end-to-end for all 33 resource types with filtering, parallelism, and secret redaction
@@ -158,7 +158,6 @@
158158

159159
- [ ] T055 [P] Implement OTel integration in src/lib/otel-setup.ts (load --otel config YAML, initialize NodeSDK with OTLP exporter, create spans per resource type/resource, metrics for counts/duration per research.md R9)
160160
- [ ] T056 [P] Add --api-version global flag support in src/cli/index.ts and src/clients/apim-client.ts (override default 2024-05-01 per FR-012)
161-
- [ ] T057 [P] Implement --spec-format option for extract in src/services/api-extractor.ts (request specific format from APIM export API where conversion supported; fallback to native with warning per FR-011)
162161
- [ ] T058 Run quickstart.md validation (execute each quickstart command against a test APIM instance, verify expected outputs)
163162
- [ ] T059 Add bin entry to package.json and shebang to src/cli/index.ts for global npm install (`npx apiops` / `npm install -g`)
164163

@@ -248,4 +247,4 @@ T029: JSON output mode → src/cli/extract-command.ts
248247
4. Add US3 (CI/CD) → Test in GitHub Actions pipeline
249248
5. Add US4 (Init) → Test scaffold generation in empty repo
250249
6. Add US5 (Extensibility) → Verify new command pattern
251-
7. Polish → OTel, spec-format, quickstart validation
250+
7. Polish → OTel, quickstart validation

src/cli/extract-command.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* Extract command CLI registration
55
* Commander subcommand with --resource-group, --service-name, --output,
6-
* --filter, --no-transitive, --spec-format flags.
6+
* --filter, --no-transitive flags.
77
* Includes --format json: machine-readable JSON output mode.
88
*/
99

@@ -26,7 +26,6 @@ interface ExtractOptions {
2626
output: string;
2727
filter?: string;
2828
transitive: boolean;
29-
specFormat?: string;
3029
}
3130

3231
/**
@@ -40,7 +39,6 @@ export function createExtractCommand(): Command {
4039
.option('--output <dir>', 'Output directory path', './apim-artifacts')
4140
.option('--filter <path>', 'Filter configuration YAML file')
4241
.option('--no-transitive', 'Disable transitive dependency inclusion')
43-
.option('--spec-format <format>', 'API specification format (openapi-v2-json, openapi-v3-json, openapi-v3-yaml)')
4442
.action(async (options: ExtractOptions, command: Command) => {
4543
const globalOpts = command.optsWithGlobals<{
4644
logLevel?: string;
@@ -109,7 +107,6 @@ async function executeExtract(
109107
outputDir: options.output,
110108
filter: filterConfig,
111109
includeTransitive: options.transitive,
112-
specFormat: options.specFormat,
113110
logLevel: parseLogLevel(globalOpts.logLevel ?? 'info'),
114111
};
115112

src/models/config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export interface ExtractConfig {
1313
outputDir: string;
1414
filter?: FilterConfig;
1515
includeTransitive: boolean;
16-
specFormat?: string;
1716
logLevel: LogLevel;
1817
otelConfigPath?: string;
1918
}

tests/unit/cli/extract-command.test.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@ describe('extract-command', () => {
5252
expect(noTransOpt).toBeDefined();
5353
});
5454

55-
it('should have --spec-format option', () => {
56-
const cmd = createExtractCommand();
57-
const opts = cmd.options;
58-
const specOpt = opts.find((o) => o.long === '--spec-format');
59-
expect(specOpt).toBeDefined();
60-
});
61-
6255
it('should have a description', () => {
6356
const cmd = createExtractCommand();
6457
expect(cmd.description()).toBeTruthy();

0 commit comments

Comments
 (0)