@maxceem/agw 0.1.8 → 0.1.10

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 (3) hide show
  1. package/README.md +48 -9
  2. package/dist/agw.mjs +1004 -218
  3. package/package.json +13 -2
package/README.md CHANGED
@@ -27,18 +27,26 @@ Add a provider. Paste its API key into the hidden prompt.
27
27
  agw provider add --type openai
28
28
  ```
29
29
 
30
- Add an app. It uses every provider you have added.
30
+ Add an app. It uses every provider you have added. A server app is created with
31
+ an application key, written to a private file; an iOS app authenticates with
32
+ App Attest instead and ships no key.
31
33
 
32
34
  ```sh
35
+ agw app add --type server --name "My backend"
33
36
  agw app add --type ios --team-id ABCDE12345 --bundle-id com.example.app
34
37
  ```
35
38
 
36
- Print the Swift code that calls the gateway from that app.
39
+ Creating an app prints the request it can send. To print it again — as curl for
40
+ a server app, as Swift for an iOS one:
37
41
 
38
42
  ```sh
39
- agw app snippet <app-id> --provider openai
43
+ agw app snippet <app-id>
44
+ agw app snippet <app-id> --provider openai # when several could serve it
40
45
  ```
41
46
 
47
+ The example is written from the app's own providers and models, and uses named
48
+ placeholders such as `PROVIDER_SLUG` for anything not configured yet.
49
+
42
50
  ## Self-host on Cloudflare
43
51
 
44
52
  The package drives Wrangler and installs the gateway release of its own version.
@@ -80,7 +88,10 @@ The whole documentation is also published as
80
88
  [agents.md](https://docs.appaigateway.com/agents.md).
81
89
 
82
90
  **Output.** Add `--json` for exactly one JSON document on stdout; progress goes
83
- to stderr. Add `--no-input` to fail instead of prompting.
91
+ to stderr. Without `--json`, output is plain text and a failure is printed to
92
+ stderr, so stdout carries only the command's own output. Colour is used only
93
+ when the destination is a terminal, and `NO_COLOR` turns it off. Add
94
+ `--no-input` to fail instead of prompting.
84
95
 
85
96
  ```json
86
97
  { "schemaVersion": 1, "ok": true, "context": { "url": "...", "accountId": "..." }, "result": { } }
@@ -118,14 +129,42 @@ overwritten. `app validate --file` checks a file without touching the account.
118
129
  Windows), mode 0700. Do not delete it to fix an authentication error; run
119
130
  `agw account login` instead. Output files are never overwritten.
120
131
 
121
- ## Contributing
132
+ ## Local development
133
+
134
+ The source lives in `cli/` of the
135
+ [main repository](https://github.com/maxceem/app-ai-gateway). Clone it and run
136
+ `pnpm install`.
137
+
138
+ From the repository root, `pnpm cli:dev` is `agw` built from your own source
139
+ instead of an installed copy. It rebuilds before every run, so your latest edit
140
+ is always the one that runs.
141
+
142
+ ```sh
143
+ pnpm cli:dev account login
144
+ pnpm cli:dev provider add --type openai
145
+ pnpm cli:dev app list
146
+ ```
147
+
148
+ It keeps its state in `.agw-dev/`, separate from the state an installed `agw`
149
+ uses. To start again from nothing:
150
+
151
+ ```sh
152
+ pnpm cli:dev:reset
153
+ ```
154
+
155
+ Deploying needs the gateway itself built too, once per change to the Worker,
156
+ console or migrations:
157
+
158
+ ```sh
159
+ pnpm --filter @maxceem/agw release:build
160
+ pnpm cli:dev deployment setup --name my-gateway --no-domain
161
+ ```
122
162
 
123
- The CLI lives in `cli/` of the
124
- [main repository](https://github.com/maxceem/app-ai-gateway). From the repo root:
163
+ Type-check and test:
125
164
 
126
165
  ```sh
127
- pnpm run cli:check # type-check and bundle
128
- pnpm run cli:test # run the CLI tests
166
+ pnpm run cli:check
167
+ pnpm run cli:test
129
168
  ```
130
169
 
131
170
  ## License