@repome/sdk 0.1.8 → 0.3.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.
- package/README.md +21 -9
- package/dist/index.d.mts +1436 -118
- package/dist/index.mjs +4305 -59
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,8 +8,8 @@ runtime with no clone required.
|
|
|
8
8
|
```ts
|
|
9
9
|
import { repome } from '@repome/sdk'
|
|
10
10
|
|
|
11
|
-
const git = await repome('
|
|
12
|
-
token: process.env.
|
|
11
|
+
const git = await repome('my-repo', {
|
|
12
|
+
token: process.env.REPOME_API_KEY!,
|
|
13
13
|
})
|
|
14
14
|
|
|
15
15
|
await git.add('src/main.ts', sourceCode)
|
|
@@ -17,14 +17,26 @@ await git.add('README.md', readmeText)
|
|
|
17
17
|
|
|
18
18
|
const commit = await git.commit('feat: generated output')
|
|
19
19
|
console.log(commit.sha) // a1b2c3d4...
|
|
20
|
-
console.log(commit.url) // https://api.repome.sh/
|
|
20
|
+
console.log(commit.url) // https://api.repome.sh/my-repo/commit/a1b2c3d
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
`repome(
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
`repome(name, options)` returns a `GitRepo` bound to one repo, addressed by
|
|
24
|
+
bare name and scoped to the API key's active org — there is no `org/` prefix.
|
|
25
|
+
The repo is created automatically if it does not exist. Files staged with
|
|
26
|
+
`add()` are held in memory and pushed as a single atomic commit when you call
|
|
26
27
|
`commit()`.
|
|
27
28
|
|
|
29
|
+
`token` must be an `rpme_` API key — create one with
|
|
30
|
+
`repome keys create <name> --scope repos:write` or the `keys.create` API.
|
|
31
|
+
Repo-scoped `art_v1_*` tokens (the output of `tokens.mint` /
|
|
32
|
+
`repome tokens mint`) are **not** accepted by the SDK; they are git
|
|
33
|
+
credentials only, used as the Basic-auth password when cloning or pushing
|
|
34
|
+
the repo's remote with plain git:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
git clone https://x-access-token:<art_v1_token>@<repo-remote>
|
|
38
|
+
```
|
|
39
|
+
|
|
28
40
|
```ts
|
|
29
41
|
interface GitRepo {
|
|
30
42
|
add(path: string, content: string | Uint8Array): Promise<void>
|
|
@@ -70,7 +82,7 @@ const client = createClient({
|
|
|
70
82
|
apiKey: process.env.REPOME_API_KEY!,
|
|
71
83
|
})
|
|
72
84
|
|
|
73
|
-
const { items } = await client.repos.list({
|
|
85
|
+
const { items } = await client.repos.list({})
|
|
74
86
|
```
|
|
75
87
|
|
|
76
88
|
API keys must use the `rpme_` prefix and are sent as
|
|
@@ -99,5 +111,5 @@ REPOME_SMOKE_NAME=sdk-smoke vp run @repome/sdk#smoke
|
|
|
99
111
|
|
|
100
112
|
Inputs: `REPOME_API_KEY` (required; needs `repos:read` + `repos:write`),
|
|
101
113
|
`REPOME_SERVER_URL` (default `https://api.repome.sh`),
|
|
102
|
-
`
|
|
103
|
-
|
|
114
|
+
`REPOME_SMOKE_NAME`, `REPOME_SMOKE_KEEP=1`. The repo is created in the API
|
|
115
|
+
key's active org.
|