Replace `SamCli<Command>Invocation` classes with a single `SamCli` interface.
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 807
- Avg merge
- 10h 12m
- Merged PRs (30d)
- 7
Description
Right now each SAM CLI command has its own `SamCliInvocation` class. These classes contain mostly redundant code, and are awkward to call. We should replace this:
```typescript
export class SamCliFooInvocation {
public constructor(
args: SamCliFooInvocationArgs,
context: SamCliFooInvocationContext = ...,
) {
}
public async execute(): Promise {
invokeArgs = // convert args to command-line arguments
// Validation boilerplate.
}
}
...
const invocation = new SamCliFooInvocation({ ... })
const result = await invocation.execute()
```
With this:
```typescript
export class DefaultSamCli implements SamCli {
public constructor(context: {
// Things like taskInvoker and processInvoker
}) {
}
public async foo(args: SamCliFooArgs): Promise {
...
}
private validate(result: ChildProcessResult): void {
// shared code instead of boilerplate
}
```
Contributor guide
Research direction
Start by locating the existing SamCliInvocation classes and their callers. Compare their argument-conversion and validation paths before designing the DefaultSamCli interface and shared validation. Done means the separate invocation classes are replaced by the single interface without changing command responses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, devtools
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100