elan-cli 0.1.2__tar.gz → 0.1.3__tar.gz
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.
- {elan_cli-0.1.2 → elan_cli-0.1.3}/CHANGELOG.md +13 -1
- {elan_cli-0.1.2 → elan_cli-0.1.3}/PKG-INFO +1 -1
- {elan_cli-0.1.2 → elan_cli-0.1.3}/pyproject.toml +1 -1
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/scaffold.py +185 -2
- {elan_cli-0.1.2 → elan_cli-0.1.3}/.gitignore +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/LICENSE +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/README.md +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/__init__.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/adk.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/auth.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/client.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/config.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/deploy.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/destroy.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/doctor.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/env.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/files.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/invoke.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/logs.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/main.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/manifests.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/project.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/projects.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/rollback.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/secret.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/stream.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/tenant.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/validate.py +0 -0
- {elan_cli-0.1.2 → elan_cli-0.1.3}/src/elan_cli/wallet.py +0 -0
|
@@ -3,7 +3,19 @@
|
|
|
3
3
|
Versions follow the tag that published them — `cli/v*`. A version with no date
|
|
4
4
|
has not been published yet.
|
|
5
5
|
|
|
6
|
-
## 0.1.
|
|
6
|
+
## 0.1.3 — unreleased
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
- `elan init` makes the repository ready for an AI coding assistant. It writes
|
|
10
|
+
a `CLAUDE.md` naming the rules a deploy enforces — bump `MANIFEST.version`,
|
|
11
|
+
add targets with `elan new`, push before deploying, never put a secret in a
|
|
12
|
+
file — and linking this platform's docs and its `llms-full.txt`. It also
|
|
13
|
+
writes a `.claude/settings.json` that lets an assistant run read-only
|
|
14
|
+
commands unasked, asks before anything that deploys, spends, deletes or
|
|
15
|
+
pushes, and refuses to read `.env`. Neither file is overwritten if it exists,
|
|
16
|
+
and `.claude/settings.local.json` is git-ignored.
|
|
17
|
+
|
|
18
|
+
## 0.1.2 — 2026-11-10
|
|
7
19
|
|
|
8
20
|
### Changed
|
|
9
21
|
- `elan login` reaches the production API with no arguments. `--api` is now the
|
|
@@ -10,7 +10,9 @@ exactly the failure the cross-check exists to catch.
|
|
|
10
10
|
|
|
11
11
|
from __future__ import annotations
|
|
12
12
|
|
|
13
|
+
import json
|
|
13
14
|
from pathlib import Path
|
|
15
|
+
from urllib.parse import urlsplit
|
|
14
16
|
|
|
15
17
|
from elan_agentkit_contracts import templates
|
|
16
18
|
from elan_agentkit_contracts.identity import (
|
|
@@ -42,12 +44,16 @@ KINDS = {"agent": ("agents", "agent.py"), "workflow": ("workflows", "workflow.py
|
|
|
42
44
|
PLACEHOLDER_SHA = "0" * 40
|
|
43
45
|
|
|
44
46
|
#: DELIBERATELY SHORT. A scaffolder that writes somebody's whole ignore file
|
|
45
|
-
#: is guessing at their editor and their operating system; these
|
|
46
|
-
#:
|
|
47
|
+
#: is guessing at their editor and their operating system; these are the ones
|
|
48
|
+
#: THIS TOOL causes. `.claude/settings.local.json` is one of them because
|
|
49
|
+
#: `init` writes the shared `.claude/settings.json` beside it, and the local
|
|
50
|
+
#: file is where one developer's own permissions go — committing it would hand
|
|
51
|
+
#: their choices to everybody who clones the repo.
|
|
47
52
|
GITIGNORE = """\
|
|
48
53
|
.env
|
|
49
54
|
.venv/
|
|
50
55
|
.elan/
|
|
56
|
+
.claude/settings.local.json
|
|
51
57
|
__pycache__/
|
|
52
58
|
*.pyc
|
|
53
59
|
"""
|
|
@@ -163,6 +169,173 @@ elan deploy
|
|
|
163
169
|
"""
|
|
164
170
|
|
|
165
171
|
|
|
172
|
+
#: WHAT AN AI CODING ASSISTANT READS BEFORE IT TOUCHES ANYTHING.
|
|
173
|
+
#:
|
|
174
|
+
#: THE RULES HERE ARE THE ONES A DEPLOY ENFORCES, which is what makes them
|
|
175
|
+
#: worth a file. An assistant that does not know a changed target needs a
|
|
176
|
+
#: version bump, or that a module must be declared in `elan.yaml`, writes a
|
|
177
|
+
#: change that `elan validate` or the deploy refuses — and then, without being
|
|
178
|
+
#: told why, "fixes" it in the wrong direction. Each rule below names the
|
|
179
|
+
#: refusal it avoids.
|
|
180
|
+
#:
|
|
181
|
+
#: SHORTER THAN THE README, ON PURPOSE. The README explains the design to a
|
|
182
|
+
#: person; this is loaded into every conversation an assistant has about the
|
|
183
|
+
#: repo, so it carries rules and pointers, and the documentation — reachable as
|
|
184
|
+
#: one `llms-full.txt` — carries the rest.
|
|
185
|
+
CLAUDE_TEMPLATE = """\
|
|
186
|
+
# {project}
|
|
187
|
+
|
|
188
|
+
Google ADK agents and workflows that the Elan platform builds, deploys and runs.
|
|
189
|
+
This repository holds only agent code and one deploy contract. The platform
|
|
190
|
+
supplies the image, the infrastructure and the pipeline, so there is no
|
|
191
|
+
Dockerfile, Kubernetes manifest, Terraform or CI workflow here, and none should
|
|
192
|
+
be added.
|
|
193
|
+
|
|
194
|
+
## Documentation
|
|
195
|
+
|
|
196
|
+
{docs}
|
|
197
|
+
|
|
198
|
+
## Layout
|
|
199
|
+
|
|
200
|
+
- `elan.yaml` is the deploy contract: the tenant, the project, the source
|
|
201
|
+
repository, every target, and what each is given — resources, scaling, model
|
|
202
|
+
keys, secrets, egress. The platform reads it without running your code.
|
|
203
|
+
- `agents/<module>/agent.py` and `workflows/<module>/workflow.py` are one target
|
|
204
|
+
each. Every one exports `MANIFEST` (slug, version, model, tools, limits,
|
|
205
|
+
price) and `build(ctx)`, which returns the ADK agent or `google.adk.Workflow`.
|
|
206
|
+
- `.env` holds local settings and the model key, for `elan adk web` only. It is
|
|
207
|
+
git-ignored and a deployed pod never reads it.
|
|
208
|
+
|
|
209
|
+
## Commands
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
elan validate # elan.yaml against every MANIFEST, both ways
|
|
213
|
+
elan adk web # run the agents locally, behind the platform's plugins
|
|
214
|
+
elan new agent <slug> # add a target: writes the module AND declares it
|
|
215
|
+
elan new workflow <slug>
|
|
216
|
+
elan deploy # builds the PUSHED commit, not the working tree
|
|
217
|
+
elan status <deployment-id> # the phase a deploy reached, and why it stopped
|
|
218
|
+
elan logs <deployment-id> # the build output
|
|
219
|
+
elan invoke <slug> --text "..." # talk to a deployed agent
|
|
220
|
+
elan secret ls # which secrets are set, names only
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Rules
|
|
224
|
+
|
|
225
|
+
- **Add a target with `elan new`, never by hand.** A module missing from
|
|
226
|
+
`elan.yaml`, or an entry with no module, is refused at deploy.
|
|
227
|
+
- **Bump `MANIFEST.version` whenever you change a target.** A deploy refuses a
|
|
228
|
+
target whose code changed under an unchanged version.
|
|
229
|
+
- **Run `elan validate` before every commit** and fix everything it reports.
|
|
230
|
+
- **Commit and push before `elan deploy`.** It builds the remote commit.
|
|
231
|
+
- **No secret value goes in any file** — not `elan.yaml`, a MANIFEST, code or a
|
|
232
|
+
commit. A person sets the value with `elan secret set`; `elan.yaml` names it
|
|
233
|
+
under a target's `secrets:`; code reads `os.environ["..."]`. Never read,
|
|
234
|
+
print or edit `.env`.
|
|
235
|
+
- **Use the platform's variable names.** The model key is `GOOGLE_API_KEY`
|
|
236
|
+
because `llm.keys` in `elan.yaml` resolves to it; an invented name works
|
|
237
|
+
locally and reads nothing once deployed.
|
|
238
|
+
- **Keep everything a target imports inside its own directory.** The image is
|
|
239
|
+
built from `agents/` and `workflows/` only; a `lib/` at the root is gone in
|
|
240
|
+
the pod.
|
|
241
|
+
- **Never list `agentkit-*` packages in a `pyproject.toml`.** The runtime image
|
|
242
|
+
carries ADK and the platform's packages; add one only for libraries beyond
|
|
243
|
+
those.
|
|
244
|
+
- **Declare every tool that acts in `MANIFEST.actions`.** An undeclared tool is
|
|
245
|
+
not governed by autonomy policy, so it runs without anybody being asked.
|
|
246
|
+
- **Slugs are identity.** 5 to 16 characters, lowercase letters, digits and
|
|
247
|
+
single hyphens, starting with a letter. Renaming one makes a new agent.
|
|
248
|
+
|
|
249
|
+
## ADK behavior that surprises people
|
|
250
|
+
|
|
251
|
+
- The graph class is `google.adk.Workflow`. ADK's docs describe a `GraphAgent`
|
|
252
|
+
that does not ship.
|
|
253
|
+
- A workflow node receives the previous node's output, so put model nodes at
|
|
254
|
+
the end: a model between two function nodes hands the second a sentence.
|
|
255
|
+
- A workflow whose last node is a `FunctionNode` returns nothing to a caller
|
|
256
|
+
unless that node returns an `Event` with `content`.
|
|
257
|
+
- `node_input` is a reserved parameter name, and an optional declared input
|
|
258
|
+
must still be present in session state.
|
|
259
|
+
- A paused run emits no `finished` event; a client waiting for one waits out
|
|
260
|
+
its whole timeout.
|
|
261
|
+
- To test with no model access, register a fake model in ADK's `LLMRegistry`
|
|
262
|
+
and select it with `MODEL_OVERRIDE`; the building-an-agent guide has the
|
|
263
|
+
recipe. `AGENTKIT_ENV=local`, already in `.env`, is what permits it.
|
|
264
|
+
"""
|
|
265
|
+
|
|
266
|
+
#: Allowed without asking: commands that only read. Asked about: everything
|
|
267
|
+
#: that deploys, spends, deletes or publishes. Denied: the file with the key.
|
|
268
|
+
#:
|
|
269
|
+
#: `.env` IS DENIED RATHER THAN MERELY ASKED ABOUT because nothing an assistant
|
|
270
|
+
#: does needs the key's value — the CLI and `adk web` read it themselves — and
|
|
271
|
+
#: a value read into a conversation is a value that can end up in a commit, a
|
|
272
|
+
#: log or a paste.
|
|
273
|
+
_READ_ONLY = ("validate", "status", "logs", "whoami", "agents", "secret ls",
|
|
274
|
+
"doctor")
|
|
275
|
+
_CONSEQUENTIAL = ("deploy", "rollback", "destroy", "secret set", "secret rm",
|
|
276
|
+
"wallet", "projects create")
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
def _claude_settings(console: str) -> str:
|
|
280
|
+
"""`.claude/settings.json`, shared by everybody who clones the repo."""
|
|
281
|
+
allow = [f"Bash(elan {command}:*)" for command in _READ_ONLY]
|
|
282
|
+
allow += ["Bash(git status:*)", "Bash(git diff:*)", "Bash(git log:*)"]
|
|
283
|
+
if host := urlsplit(console).hostname:
|
|
284
|
+
# THE DOCS ARE WHAT IT SHOULD READ INSTEAD OF GUESSING, so fetching
|
|
285
|
+
# them is not something to stop and ask about.
|
|
286
|
+
allow.append(f"WebFetch(domain:{host})")
|
|
287
|
+
settings = {
|
|
288
|
+
"$schema": "https://json.schemastore.org/claude-code-settings.json",
|
|
289
|
+
"permissions": {
|
|
290
|
+
"allow": allow,
|
|
291
|
+
"ask": [f"Bash(elan {command}:*)" for command in _CONSEQUENTIAL]
|
|
292
|
+
+ ["Bash(git push:*)"],
|
|
293
|
+
"deny": ["Read(./.env)", "Read(./.env.*)", "Edit(./.env)"],
|
|
294
|
+
},
|
|
295
|
+
}
|
|
296
|
+
return json.dumps(settings, indent=2) + "\n"
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
def _console() -> str:
|
|
300
|
+
"""This platform's console, e.g. `https://openelan.ai/app`, or `""`.
|
|
301
|
+
|
|
302
|
+
ANSWERED BY THE PLATFORM WHEN IT CAN BE. `elan login` caches the device
|
|
303
|
+
sign-in page the platform names, which is `<console>/device` — so after a
|
|
304
|
+
login the console is known rather than composed. Before one, the API's own
|
|
305
|
+
`api.<domain>` naming gives `<domain>/app`; anything else (a laptop's
|
|
306
|
+
`localhost`) gives nothing, and the file says where the docs live in words
|
|
307
|
+
instead of linking somewhere wrong.
|
|
308
|
+
|
|
309
|
+
NEVER RAISES. A config this cannot read must not stop a scaffold — the docs
|
|
310
|
+
link is a convenience, and `init` has written nothing else that depends on
|
|
311
|
+
it.
|
|
312
|
+
"""
|
|
313
|
+
from elan_cli.config import Config, ConfigError # noqa: PLC0415
|
|
314
|
+
|
|
315
|
+
try:
|
|
316
|
+
config = Config.load()
|
|
317
|
+
except ConfigError:
|
|
318
|
+
return ""
|
|
319
|
+
if config.device_url.endswith("/device"):
|
|
320
|
+
return config.device_url[: -len("/device")]
|
|
321
|
+
parts = urlsplit(config.api)
|
|
322
|
+
if parts.hostname and parts.hostname.startswith("api."):
|
|
323
|
+
return f"{parts.scheme}://{parts.netloc[len('api.'):]}/app"
|
|
324
|
+
return ""
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
def _docs_section(console: str) -> str:
|
|
328
|
+
if not console:
|
|
329
|
+
return ("The platform's documentation is in its console, under `/docs`. "
|
|
330
|
+
"Beside it,\n`llms-full.txt` holds every page in one file, "
|
|
331
|
+
"written for a model.")
|
|
332
|
+
return (f"This platform's documentation is at {console}/docs. Read the "
|
|
333
|
+
"page for\nwhat you are changing before guessing at an API.\n\n"
|
|
334
|
+
f"- {console}/llms.txt indexes every page, one line each.\n"
|
|
335
|
+
f"- {console}/llms-full.txt holds every page in one file,\n"
|
|
336
|
+
" written for a model.")
|
|
337
|
+
|
|
338
|
+
|
|
166
339
|
def _slug_ok(slug: str, *, lo: int, hi: int) -> bool:
|
|
167
340
|
import re
|
|
168
341
|
|
|
@@ -270,14 +443,24 @@ def init(directory: Path, *, tenant: str, project: str, repo: str,
|
|
|
270
443
|
# NONE OF THESE OVERWRITE. A directory that already has one has it for
|
|
271
444
|
# reasons this does not know, and `init` refusing to clobber is the same
|
|
272
445
|
# rule elan.yaml gets a paragraph about above.
|
|
446
|
+
#
|
|
447
|
+
# CLAUDE.md AND .claude/ MAKE THE REPO READY FOR AN AI ASSISTANT from its
|
|
448
|
+
# first commit: the rules a deploy enforces, where the docs are, and which
|
|
449
|
+
# commands it may run without asking. Not overwritten either — a repo that
|
|
450
|
+
# already instructs its assistant has reasons this does not know.
|
|
451
|
+
console = _console()
|
|
273
452
|
written = []
|
|
274
453
|
for name, body in (
|
|
275
454
|
(".gitignore", GITIGNORE),
|
|
276
455
|
(".env", ENV_TEMPLATE.format(project=project)),
|
|
277
456
|
("README.md", README_TEMPLATE.format(project=project)),
|
|
457
|
+
("CLAUDE.md", CLAUDE_TEMPLATE.format(project=project,
|
|
458
|
+
docs=_docs_section(console))),
|
|
459
|
+
(".claude/settings.json", _claude_settings(console)),
|
|
278
460
|
):
|
|
279
461
|
path = directory / name
|
|
280
462
|
if not path.exists():
|
|
463
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
281
464
|
path.write_text(body)
|
|
282
465
|
written.append(path)
|
|
283
466
|
spec_path.write_text(SPEC_TEMPLATE.format(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|