Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
db3fe9f
feat(sdk): add the pristine store behind custom code
asadali214 Oct 20, 2026
185e066
feat(sdk): merge regenerated SDKs through the system git
asadali214 Oct 20, 2026
4d5b9cc
feat(sdk): keep your edits when regenerating an SDK
asadali214 Oct 20, 2026
8745391
feat(sdk): mark conflicts in git's index and explain a missing snapshot
asadali214 Oct 20, 2026
d857ea4
docs(sdk): record the custom-code design and how edits are kept
asadali214 Oct 20, 2026
fc026fb
docs(sdk): correct the undo command for the previous snapshot
asadali214 Oct 20, 2026
6ef3540
feat(sdk): name the customized files after a regeneration
asadali214 Oct 20, 2026
971195b
refactor(sdk): carry merge paths as RelativeFilePath
asadali214 Oct 20, 2026
a11166f
refactor(sdk): fold the merge service into the pristine store
asadali214 Oct 21, 2026
d39ea50
refactor(sdk): make the repository a context
asadali214 Oct 21, 2026
8e9e9bf
refactor(sdk): fold the merge layer into types and the git service
asadali214 Oct 21, 2026
8217ac5
feat(sdk): share snapshots through the remote
asadali214 Oct 21, 2026
270f6e8
refactor(sdk): keep the prompts to wording
asadali214 Oct 21, 2026
3596340
refactor(sdk): move the git types to src/types/git
asadali214 Oct 21, 2026
0fa08d3
refactor(sdk): keep the closing text with the prompts
asadali214 Oct 21, 2026
c2dd9f2
fix(sdk): keep the custom-code messages short and free of internals
asadali214 Oct 21, 2026
e1dd8d6
feat(sdk)!: remove --zip from sdk generate
asadali214 Oct 21, 2026
7c181df
feat(sdk): share snapshots with a pre-push hook instead of pushing fr…
asadali214 Oct 22, 2026
07c03c1
feat(sdk): ask what to do when a regeneration conflicts
asadali214 Oct 22, 2026
5679d46
docs(plan): record phase 9's commit
asadali214 Oct 22, 2026
9547c4e
refactor(sdk): fold the generate run into one action, with a silent core
asadali214 Oct 22, 2026
7774f85
test(sdk): make the clone and path tests pass on every runner
asadali214 Oct 23, 2026
f202faf
fix(sdk): find unresolved conflicts in git's index, not in marker text
asadali214 Oct 23, 2026
7ad6d3b
refactor(sdk): hand the prompts to the steps as delegates
asadali214 Oct 23, 2026
f955046
refactor(sdk): move the download into its own step, and let the actio…
asadali214 Oct 23, 2026
43ce5ab
fix(sdk): share the snapshot of an SDK at the repository root
asadali214 Oct 23, 2026
603567b
feat(sdk): resolve conflicts with your own changes, and drop the undo
asadali214 Oct 23, 2026
0ac2d07
fix(sdk): generate into --destination itself, so a clone of the SDK i…
asadali214 Oct 23, 2026
2d8d470
fix(sdk): merge the generation record as binary, so a pull never writ…
asadali214 Oct 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
560 changes: 560 additions & 0 deletions .ai/plans/custom-code.md

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions CONTEXT.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,21 @@ _Avoid_: Example name, variant
**Unplaced sample**:
A code sample whose endpoint no spec in the source directory declares.
_Avoid_: Orphan sample, missing operation

### SDK regeneration

**SDK directory**:
The directory `sdk generate` writes an SDK into, and reads back on every later run: the `--destination` itself when one is named, else `<input>/sdk/<language>`, or `<input>/sdk/<api-version>/<language>`.
_Avoid_: Destination, output directory, language directory

**Pristine snapshot**:
One generation's output exactly as the server returned it, stored as a commit under the hidden ref `refs/apimatic/pristine/<path>` of the repository enclosing the SDK directory, never on a branch; the base of the next merge.
_Avoid_: Generated snapshot, baseline, original

**Generation record**:
`<sdk>/.apimatic/generation.json`, committed with the SDK, naming the pristine snapshot the directory was last written from. Written with `.apimatic/.gitattributes` beside it, so git merges it as binary and GitHub collapses it in pull requests.
_Avoid_: Lock file, manifest, metadata file

**Custom code**:
Whatever differs between the SDK directory on disk and its pristine snapshot: the developer's edits, additions, deletions and moves, kept by merging the next generation over them.
_Avoid_: Customizations (in code), user changes, overrides
48 changes: 26 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ The official CLI for APIMatic.
Node.js 24 or newer, for every command. npm only warns when your Node is older, so the
install succeeds and the CLI then refuses to run, naming the version it found.

Git 2.38 or newer on your `PATH`, for `sdk generate` to keep your changes to a generated SDK
across regenerations.
Without it the command still generates, and warns that your customizations will not persist.

# Getting Started

To get started with APIMatic's CLI using a step by step wizard, run the following command:
Expand All @@ -28,7 +32,7 @@ $ npm install -g @apimatic/cli
$ apimatic COMMAND
running command...
$ apimatic (--version)
@apimatic/cli/1.3.1 win32-x64 node-v24.19.0
@apimatic/cli/1.5.0 win32-x64 node-v24.21.0
$ apimatic --help [COMMAND]
USAGE
$ apimatic COMMAND
Expand Down Expand Up @@ -86,7 +90,7 @@ EXAMPLES
apimatic api transform --format=raml --url="https://petstore.swagger.io/v2/swagger.json" --destination=./
```

_See code: [src/commands/api/transform.ts](https://github.com/apimatic/apimatic-cli/blob/v1.3.1/src/commands/api/transform.ts)_
_See code: [src/commands/api/transform.ts](https://github.com/apimatic/apimatic-cli/blob/v1.5.0/src/commands/api/transform.ts)_

## `apimatic api validate`

Expand Down Expand Up @@ -119,7 +123,7 @@ EXAMPLES
apimatic api validate --url="https://petstore.swagger.io/v2/swagger.json"
```

_See code: [src/commands/api/validate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.3.1/src/commands/api/validate.ts)_
_See code: [src/commands/api/validate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.5.0/src/commands/api/validate.ts)_

## `apimatic auth login`

Expand All @@ -143,7 +147,7 @@ EXAMPLES
apimatic auth login --auth-key={api-key}
```

_See code: [src/commands/auth/login.ts](https://github.com/apimatic/apimatic-cli/blob/v1.3.1/src/commands/auth/login.ts)_
_See code: [src/commands/auth/login.ts](https://github.com/apimatic/apimatic-cli/blob/v1.5.0/src/commands/auth/login.ts)_

## `apimatic auth logout`

Expand All @@ -162,7 +166,7 @@ EXAMPLES
apimatic auth logout
```

_See code: [src/commands/auth/logout.ts](https://github.com/apimatic/apimatic-cli/blob/v1.3.1/src/commands/auth/logout.ts)_
_See code: [src/commands/auth/logout.ts](https://github.com/apimatic/apimatic-cli/blob/v1.5.0/src/commands/auth/logout.ts)_

## `apimatic auth status`

Expand All @@ -179,7 +183,7 @@ EXAMPLES
apimatic auth status
```

_See code: [src/commands/auth/status.ts](https://github.com/apimatic/apimatic-cli/blob/v1.3.1/src/commands/auth/status.ts)_
_See code: [src/commands/auth/status.ts](https://github.com/apimatic/apimatic-cli/blob/v1.5.0/src/commands/auth/status.ts)_

## `apimatic autocomplete [SHELL]`

Expand Down Expand Up @@ -251,8 +255,8 @@ DESCRIPTION
Generate a context plugin for your SDKs.

Generate a context plugin that teaches an AI coding assistant how to use your SDKs. Requires an input directory
containing a `src` directory with your API specification — `apimatic.json` is created if it is not there. It asks
for the plugin's name on the first run, and for its languages only when `apimatic.json` records none (`sdk publish`
containing a `src` directory with your API specification — `apimatic.json` is created if it is not there. It asks for
the plugin's name on the first run, and for its languages only when `apimatic.json` records none (`sdk publish`
records them). Later runs read both from `apimatic.json` without asking.

EXAMPLES
Expand All @@ -261,7 +265,7 @@ EXAMPLES
apimatic plugin generate --input="./" --destination="./plugin"
```

_See code: [src/commands/plugin/generate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.3.1/src/commands/plugin/generate.ts)_
_See code: [src/commands/plugin/generate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.5.0/src/commands/plugin/generate.ts)_

## `apimatic plugin publish`

Expand All @@ -288,7 +292,7 @@ EXAMPLES
apimatic plugin publish --input="./" --destination="./plugin"
```

_See code: [src/commands/plugin/publish.ts](https://github.com/apimatic/apimatic-cli/blob/v1.3.1/src/commands/plugin/publish.ts)_
_See code: [src/commands/plugin/publish.ts](https://github.com/apimatic/apimatic-cli/blob/v1.5.0/src/commands/plugin/publish.ts)_

## `apimatic portal generate`

Expand Down Expand Up @@ -328,7 +332,7 @@ EXAMPLES
apimatic portal generate --zip
```

_See code: [src/commands/portal/generate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.3.1/src/commands/portal/generate.ts)_
_See code: [src/commands/portal/generate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.5.0/src/commands/portal/generate.ts)_

## `apimatic portal serve`

Expand Down Expand Up @@ -364,7 +368,7 @@ EXAMPLES
apimatic portal serve --input=./ --port=23513 --open
```

_See code: [src/commands/portal/serve.ts](https://github.com/apimatic/apimatic-cli/blob/v1.3.1/src/commands/portal/serve.ts)_
_See code: [src/commands/portal/serve.ts](https://github.com/apimatic/apimatic-cli/blob/v1.5.0/src/commands/portal/serve.ts)_

## `apimatic publishing profile list`

Expand All @@ -383,7 +387,7 @@ EXAMPLES
apimatic publishing profile list
```

_See code: [src/commands/publishing/profile/list.ts](https://github.com/apimatic/apimatic-cli/blob/v1.3.1/src/commands/publishing/profile/list.ts)_
_See code: [src/commands/publishing/profile/list.ts](https://github.com/apimatic/apimatic-cli/blob/v1.5.0/src/commands/publishing/profile/list.ts)_

## `apimatic quickstart`

Expand All @@ -403,7 +407,7 @@ EXAMPLES
apimatic quickstart
```

_See code: [src/commands/quickstart.ts](https://github.com/apimatic/apimatic-cli/blob/v1.3.1/src/commands/quickstart.ts)_
_See code: [src/commands/quickstart.ts](https://github.com/apimatic/apimatic-cli/blob/v1.5.0/src/commands/quickstart.ts)_

## `apimatic sdk generate`

Expand All @@ -412,11 +416,11 @@ Generate an SDK for your API
```
USAGE
$ apimatic sdk generate -l csharp|java|php|python|ruby|typescript|go [-d <value>] [--api-version <value>]
[--zip] [--codegen-version v4] [--stability stable|beta] [-i <value>] [-f] [-k <value>]
[--codegen-version v4] [--stability stable|beta] [-i <value>] [-f] [-k <value>]

FLAGS
-d, --destination=<value> [default: <input>/sdk/<language> | <input>/sdk/<api-version>/<language>] path where
the SDK will be generated
-d, --destination=<value> [default: <input>/sdk/<language> | <input>/sdk/<api-version>/<language>] directory the
SDK is generated into
-f, --force overwrite changes without asking for user consent.
-i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which
includes API specifications and configuration files.
Expand All @@ -428,23 +432,23 @@ FLAGS
<options: v4>
--stability=<option> Stability level of the generated SDK. Defaults to the level the language offers.
<options: stable|beta>
--zip Download the generated SDK as a .zip archive

DESCRIPTION
Generate an SDK for your API

Generate a Software Development Kit (SDK) from an API specification.
C#, TypeScript and Python are available; Java, Ruby, Go and PHP are coming soon.
With git 2.38 or newer installed, your edits to the generated SDK are kept when you regenerate it.

EXAMPLES
apimatic sdk generate --language=typescript

apimatic sdk generate --language=csharp --input=./

apimatic sdk generate --language=python --destination=./sdk --zip
apimatic sdk generate --language=python --destination=./my-python-sdk
```

_See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.3.1/src/commands/sdk/generate.ts)_
_See code: [src/commands/sdk/generate.ts](https://github.com/apimatic/apimatic-cli/blob/v1.5.0/src/commands/sdk/generate.ts)_

## `apimatic sdk publish`

Expand All @@ -457,7 +461,7 @@ USAGE
stable|beta]

FLAGS
-d, --destination=<value> [default: <input>/sdk] path where the sdk will be generated.
-d, --destination=<value> [default: <input>/sdk/<language>] path where the sdk will be generated.
-f, --force overwrite changes without asking for user consent.
-i, --input=<value> [default: ./] path to the parent directory containing the 'src' directory, which
includes API specifications and configuration files.
Expand Down Expand Up @@ -491,5 +495,5 @@ EXAMPLES
apimatic sdk publish --profile-id=c3d4e5f6a1b2c3d4e5f6a1b2 --language=python --version=1.0.0 --publish-type=package --dry-run
```

_See code: [src/commands/sdk/publish.ts](https://github.com/apimatic/apimatic-cli/blob/v1.3.1/src/commands/sdk/publish.ts)_
_See code: [src/commands/sdk/publish.ts](https://github.com/apimatic/apimatic-cli/blob/v1.5.0/src/commands/sdk/publish.ts)_
<!-- commandsstop -->
11 changes: 11 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading