@nurix/apollo 0.4.1 → 0.4.3
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 +18 -47
- package/dist/commands/init.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
# `@nurix/apollo` — the `apollo` CLI
|
|
2
2
|
|
|
3
|
-
The consumer-side installer for the Apollo discovery plane. It implements the
|
|
4
|
-
build-time integration flow of the
|
|
5
|
-
[consumer journey](../../docs/discovery/consumer-journey.md): exchange your
|
|
6
|
-
application key for service-scoped credentials, write them into a managed
|
|
7
|
-
`.env` block, install the service's npm package, and record the `consumes`
|
|
8
|
-
edge in your `apollo.service.json` (the application's bill of materials).
|
|
3
|
+
The consumer-side installer for the Apollo discovery plane. It implements the build-time integration flow of the [consumer journey](../../docs/discovery/consumer-journey.md): exchange your application key for service-scoped credentials, write them into a managed `.env` block, install the service's npm package, and record the `consumes` edge in your `apollo.service.json` (the application's bill of materials).
|
|
9
4
|
|
|
10
5
|
Interactive UX is built on [`@clack/prompts`](https://github.com/bombshell-dev/clack).
|
|
11
6
|
|
|
12
7
|
## Install
|
|
13
8
|
|
|
14
|
-
Published to npm with **restricted access** under the `@nurix` scope — you need
|
|
15
|
-
an npm account with read rights to the `nurix` org (`npm login`, then verify
|
|
16
|
-
with `npm whoami`).
|
|
9
|
+
Published to npm with **restricted access** under the `@nurix` scope — you need an npm account with read rights to the `nurix` org (`npm login`, then verify with `npm whoami`).
|
|
17
10
|
|
|
18
11
|
```
|
|
19
12
|
npx @nurix/apollo@latest --help # one-shot
|
|
@@ -53,51 +46,39 @@ apollo doctor # key validity + per-credential health probes +
|
|
|
53
46
|
apollo open <svc> [--env <name>] # open endpoint (default production) or repo URL
|
|
54
47
|
```
|
|
55
48
|
|
|
56
|
-
Global options: `--apollo-url <url>` (defaults to `$APOLLO_URL`, then the
|
|
57
|
-
hosted instance `https://apollo.nurix-ai.co`) — the default means you never
|
|
58
|
-
need to pass the URL; override only for a non-hosted Apollo.
|
|
49
|
+
Global options: `--apollo-url <url>` (defaults to `$APOLLO_URL`, then the hosted instance `https://apollo.nurix-ai.co`) — the default means you never need to pass the URL; override only for a non-hosted Apollo.
|
|
59
50
|
|
|
60
51
|
### `apollo init`
|
|
61
52
|
|
|
62
|
-
1. Prompts for your `APOLLO_APP_KEY` (created with your application in the
|
|
63
|
-
|
|
64
|
-
2. Writes it into the **Apollo-managed block** of `.env` (+ a placeholder in
|
|
65
|
-
`.env.example`) and makes sure `.env` is gitignored.
|
|
53
|
+
1. Prompts for your `APOLLO_APP_KEY` (created with your application in the Apollo console) and **validates it against Apollo — no key, no install**.
|
|
54
|
+
2. Writes it into the **Apollo-managed block** of `.env` (+ a placeholder in `.env.example`) and makes sure `.env` is gitignored.
|
|
66
55
|
3. Offers to scaffold `apollo.service.json` if the repo has none.
|
|
67
56
|
|
|
68
57
|
### `apollo add <service>` — the installer
|
|
69
58
|
|
|
70
|
-
1. Reads `APOLLO_APP_KEY` from the managed block (or the environment); fails
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
4. Writes `<SERVICE>_ENDPOINT` + `<SERVICE>_KEY` into the managed `.env`
|
|
77
|
-
block, placeholders into `.env.example`.
|
|
78
|
-
5. Installs the service's npm package when it ships one (package manager
|
|
79
|
-
detected from the repo's lockfile).
|
|
80
|
-
6. Appends the `consumes` edge to `apollo.service.json` (offers a scaffold if
|
|
81
|
-
the manifest is missing).
|
|
59
|
+
1. Reads `APOLLO_APP_KEY` from the managed block (or the environment); fails loudly with remediation if missing.
|
|
60
|
+
2. Fetches the catalogue and resolves the service (interactive select when no name is passed).
|
|
61
|
+
3. `POST /api/v1/keys/exchange` → `{ endpoint, serviceKey }` — idempotent per (application × service), so re-running is safe.
|
|
62
|
+
4. Writes `<SERVICE>_ENDPOINT` + `<SERVICE>_KEY` into the managed `.env` block, placeholders into `.env.example`.
|
|
63
|
+
5. Installs the service's npm package when it ships one (package manager detected from the repo's lockfile).
|
|
64
|
+
6. Appends the `consumes` edge to `apollo.service.json` (offers a scaffold if the manifest is missing).
|
|
82
65
|
7. Best-effort health probe against the issued endpoint (never blocks).
|
|
83
66
|
|
|
84
67
|
### The managed `.env` block
|
|
85
68
|
|
|
86
|
-
The CLI owns **only** the delimited block — everything outside it is yours and
|
|
87
|
-
is never touched:
|
|
69
|
+
The CLI owns **only** the delimited block — everything outside it is yours and is never touched:
|
|
88
70
|
|
|
89
71
|
```
|
|
90
72
|
MY_OWN_SECRET=untouched
|
|
91
73
|
|
|
92
74
|
# >>> apollo:managed — do not edit by hand; the apollo CLI rewrites this block >>>
|
|
93
|
-
APOLLO_APP_KEY=
|
|
75
|
+
APOLLO_APP_KEY=018f… # opaque app id (UUID), no fixed prefix
|
|
94
76
|
EMAIL_ENDPOINT=https://…
|
|
95
77
|
EMAIL_KEY=apollo_svc_…
|
|
96
78
|
# <<< apollo:managed <<<
|
|
97
79
|
```
|
|
98
80
|
|
|
99
|
-
Inside the block the server is the source of truth (manual edits get
|
|
100
|
-
overwritten); outside it, nothing is ever rewritten.
|
|
81
|
+
Inside the block the server is the source of truth (manual edits get overwritten); outside it, nothing is ever rewritten.
|
|
101
82
|
|
|
102
83
|
## Development
|
|
103
84
|
|
|
@@ -107,20 +88,10 @@ pnpm --filter @nurix/apollo typecheck
|
|
|
107
88
|
node packages/cli/dist/index.js --help # run from the repo root
|
|
108
89
|
```
|
|
109
90
|
|
|
110
|
-
ESM, Node ≥ 22, strict TypeScript. `bin` is `dist/index.js` (`apollo`).
|
|
111
|
-
Releases ship via `.github/workflows/publish-cli-to-npm.yml` — merges to `dev`
|
|
112
|
-
touching `packages/cli/**` auto-publish a patch; dispatch the workflow for
|
|
113
|
-
minor/major.
|
|
91
|
+
ESM, Node ≥ 22, strict TypeScript. `bin` is `dist/index.js` (`apollo`). Releases ship via `.github/workflows/publish-cli-to-npm.yml` — merges to `dev` touching `packages/cli/**` auto-publish a patch; dispatch the workflow for minor/major.
|
|
114
92
|
|
|
115
93
|
## Current limitations
|
|
116
94
|
|
|
117
|
-
- The hosted catalogue is empty until the registry read path lands
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
KV catalogue, since the exchange resolves endpoints server-side.
|
|
121
|
-
- `apollo sync` needs `GET /api/v1/keys/credentials` (journey R7) — the route
|
|
122
|
-
is in the worker code; it goes live with the next worker deploy.
|
|
123
|
-
- Exchange still returns `{endpoint, serviceKey}` together; once it slims to
|
|
124
|
-
credential-only with Apollo-served definitions (journey §9.2–§9.3), the
|
|
125
|
-
client picks the endpoint up from the definition instead
|
|
126
|
-
(`src/lib/apollo_client.ts` is the seam).
|
|
95
|
+
- The hosted catalogue is empty until the registry read path lands (consumer-journey.md R3) — `list`/`describe`/`graph`/`open` degrade with a clear message; `apollo add <name>` still works for services seeded into the KV catalogue, since the exchange resolves endpoints server-side.
|
|
96
|
+
- `apollo sync` needs `GET /api/v1/keys/credentials` (journey R7) — the route is in the worker code; it goes live with the next worker deploy.
|
|
97
|
+
- Exchange still returns `{endpoint, serviceKey}` together; once it slims to credential-only with Apollo-served definitions (journey §9.2–§9.3), the client picks the endpoint up from the definition instead (`src/lib/apollo_client.ts` is the seam).
|
package/dist/commands/init.js
CHANGED
|
@@ -43,7 +43,9 @@ export async function runInit(options) {
|
|
|
43
43
|
}
|
|
44
44
|
const appKey = await p.password({
|
|
45
45
|
message: `Paste your APOLLO_APP_KEY (create an application in the Apollo console: ${baseUrl})`,
|
|
46
|
-
|
|
46
|
+
// The key is an opaque app id (a high-entropy UUID, no fixed prefix); the
|
|
47
|
+
// authoritative check is the server probe below, so only reject empties here.
|
|
48
|
+
validate: (value) => (value?.trim() ? undefined : "Paste your APOLLO_APP_KEY"),
|
|
47
49
|
});
|
|
48
50
|
if (p.isCancel(appKey)) {
|
|
49
51
|
p.cancel("init cancelled — nothing written.");
|