arc-canteen 0.1.12__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.
@@ -0,0 +1,19 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ environment: pypi
11
+ permissions:
12
+ id-token: write
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: astral-sh/setup-uv@v6
16
+ - name: Build sdist and wheel
17
+ run: uv build
18
+ - name: Publish to PyPI (trusted publishing)
19
+ run: uv publish --trusted-publishing always
@@ -0,0 +1,25 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.egg-info/
6
+ build/
7
+ dist/
8
+ .venv/
9
+ venv/
10
+
11
+ # Tooling
12
+ .ruff_cache/
13
+ .mypy_cache/
14
+ .pytest_cache/
15
+
16
+ # Editors
17
+ .vscode/
18
+ .idea/
19
+ *.swp
20
+
21
+ # Secrets — never push these
22
+ *_PAT
23
+ *.pat
24
+ .env
25
+ .env.*
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Canteen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,144 @@
1
+ Metadata-Version: 2.4
2
+ Name: arc-canteen
3
+ Version: 0.1.12
4
+ Summary: Arc Canteen CLI — track your project's progress and submit to Arc.
5
+ Project-URL: Homepage, https://thecanteenapp.com
6
+ Project-URL: Repository, https://github.com/the-canteen-dev/ARC-cli
7
+ Project-URL: Documentation, https://docs.arc.io/arc-chain
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Requires-Python: >=3.10
11
+ Requires-Dist: httpx>=0.24.0
12
+ Requires-Dist: pyyaml>=6.0
13
+ Requires-Dist: rich>=13.0.0
14
+ Requires-Dist: typer>=0.9.0
15
+ Description-Content-Type: text/markdown
16
+
17
+ # arc-canteen CLI
18
+
19
+ The CLI for you to build your next great project on Arc!
20
+
21
+ More about Arc here: https://docs.arc.io/arc-chain
22
+
23
+ - Use `arc-canteen context | claude` in order to pipe App Kits, Arc Sample Apps and Arc / Circle docs into your build. More here: https://github.com/the-canteen-dev/context-arc
24
+ - Use our testnet RPC once you log in: https://arc-node.thecanteenapp.com/
25
+ - Make yourself known as an Arc + Canteen builder to the Circle + Canteen teams! This CLI enables Canteen, Arc and Circle to provide you prizes, support and (maybe even) investment as you keep on building!
26
+
27
+ Make sure you rotate your key regularly if you're having trouble logging in: `arc-canteen rotate-rpc-key`
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ uv tool install git+https://github.com/the-canteen-dev/ARC-cli.git
33
+ ```
34
+
35
+ This places the binary at `~/.local/bin/arc-canteen`.
36
+
37
+ ## Upgrade
38
+
39
+ ```bash
40
+ uv tool install --reinstall git+https://github.com/the-canteen-dev/ARC-cli.git
41
+ ```
42
+
43
+ ## Commands
44
+
45
+ ### Top-level
46
+
47
+ | Command | Description |
48
+ |---|---|
49
+ | `arc-canteen` | Show your dashboard (default when no subcommand given) |
50
+ | `arc-canteen login` | Authenticate with GitHub and set up your profile |
51
+ | `arc-canteen logout` | Clear your local credentials |
52
+ | `arc-canteen status` | Show your dashboard |
53
+ | `arc-canteen push` | Push any queued local events to the server |
54
+ | `arc-canteen ls [traction\|product\|all]` | List all updates |
55
+ | `arc-canteen history [traction\|product\|all]` | Alias for `ls` |
56
+ | `arc-canteen profile-edit` | Shortcut for `arc-canteen profile edit` |
57
+ | `arc-canteen update-traction` | Shortcut for `arc-canteen update traction` |
58
+ | `arc-canteen update-product` | Shortcut for `arc-canteen update product` |
59
+ | `arc-canteen submit-puzzle` | Submit your answer to the current puzzle |
60
+ | `arc-canteen rpc <method> [params]` | JSON-RPC call to the configured Arc chain |
61
+ | `arc-canteen rpc-url [--export]` | Print the JSON-RPC URL with your token embedded |
62
+ | `arc-canteen rotate-rpc-key` | Mint a fresh token, update `config.yaml` + `$RPC`, invalidate the old one |
63
+ | `arc-canteen shell-init` | Print rc snippet that auto-loads `$RPC` in every shell |
64
+ | `arc-canteen context` | Dump agent context (AGENTS.md + paths to docs and samples) |
65
+ | `arc-canteen context sync` | Clone/pull developer docs + samples from context-arc |
66
+
67
+ ### `arc-canteen profile`
68
+
69
+ | Command | Description |
70
+ |---|---|
71
+ | `arc-canteen profile` | View your profile |
72
+ | `arc-canteen profile edit` | Edit your Discord handle, Telegram, and Luma email |
73
+
74
+ ### `arc-canteen update`
75
+
76
+ | Command | Description |
77
+ |---|---|
78
+ | `arc-canteen update` | Show recent updates |
79
+ | `arc-canteen update traction` | Submit a traction update |
80
+ | `arc-canteen update product` | Submit a product update |
81
+
82
+ ### Agent context
83
+
84
+ `arc-canteen context sync` clones [the-canteen-dev/context-arc](https://github.com/the-canteen-dev/context-arc) into `~/.arc-canteen/context/`. That repo bundles developer docs for Arc + Circle plus 5 sample codebases (as submodules). Subsequent `sync` invocations `git pull --recurse-submodules`.
85
+
86
+ `arc-canteen context` prints `AGENTS.md` plus a flat path manifest — pipe-friendly:
87
+
88
+ ```bash
89
+ arc-canteen context | claude # or aider / cody / cursor
90
+ arc-canteen context --paths # just the paths, no entry-point content
91
+ arc-canteen context --full # also inline every .md / .yaml
92
+ ```
93
+
94
+ ### JSON-RPC
95
+
96
+ Use `arc-canteen rpc <method> [params_json]` to make authenticated
97
+ JSON-RPC calls against the chain configured in `~/.arc-canteen/settings.yaml`.
98
+
99
+ ```bash
100
+ arc-canteen rpc eth_blockNumber # → 0x27a766a
101
+ arc-canteen rpc eth_chainId # → 0x4cef52
102
+ arc-canteen rpc eth_getBalance '["0xabc...", "latest"]' # → 0x1bc16d674...
103
+ arc-canteen rpc eth_call '[{"to":"0xabc","data":"0x70a08231"}, "latest"]'
104
+ arc-canteen rpc eth_sendRawTransaction '["0xf86c..."]'
105
+ arc-canteen rpc eth_blockNumber --raw # full envelope
106
+ ```
107
+
108
+ The proxy enforces a method allowlist; calls to disallowed methods
109
+ return `method '<x>' not allowed by the proxy`.
110
+
111
+ ### Auto-load $RPC
112
+
113
+ `arc-canteen login` writes `export RPC='<url>'` to `~/.arc-canteen/env`. To make every new shell pick it up, install one line:
114
+
115
+ ```bash
116
+ arc-canteen shell-init >> ~/.bashrc # or ~/.zshrc
117
+ ```
118
+
119
+ After that, `$RPC` is set in every shell with no per-session step.
120
+
121
+ ### Rotating your key
122
+
123
+ ```bash
124
+ arc-canteen rotate-rpc-key
125
+ ```
126
+
127
+ Mints a fresh token (re-auth via your stored GitHub credential — no browser
128
+ step), rewrites `~/.arc-canteen/config.yaml` and `~/.arc-canteen/env`, and
129
+ invalidates the old token server-side. Update anything that hard-coded the
130
+ old URL (a project `.env`, a CI secret) with the new one.
131
+
132
+ Tokens are good for 90 days; the dashboard nudges you as that approaches.
133
+ `arc-canteen logout` also invalidates the token server-side.
134
+
135
+ ## Local state
136
+
137
+ - `~/.arc-canteen/config.yaml` — auth (token + when it was issued) + profile + cached updates
138
+ - `~/.arc-canteen/settings.yaml` — chain + event_name
139
+ - `~/.arc-canteen/queue.yaml` — append-only event queue (synced to server)
140
+ - `~/.arc-canteen/env` — `export RPC='…'`; sourced by your shell rc
141
+
142
+ ## Server
143
+
144
+ The CLI talks to `https://arc-cli-server.thecanteenapp.com`. The server is intentionally idempotent — re-sending an event that already landed is harmless, so the local queue can be replayed at any time.
@@ -0,0 +1,128 @@
1
+ # arc-canteen CLI
2
+
3
+ The CLI for you to build your next great project on Arc!
4
+
5
+ More about Arc here: https://docs.arc.io/arc-chain
6
+
7
+ - Use `arc-canteen context | claude` in order to pipe App Kits, Arc Sample Apps and Arc / Circle docs into your build. More here: https://github.com/the-canteen-dev/context-arc
8
+ - Use our testnet RPC once you log in: https://arc-node.thecanteenapp.com/
9
+ - Make yourself known as an Arc + Canteen builder to the Circle + Canteen teams! This CLI enables Canteen, Arc and Circle to provide you prizes, support and (maybe even) investment as you keep on building!
10
+
11
+ Make sure you rotate your key regularly if you're having trouble logging in: `arc-canteen rotate-rpc-key`
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ uv tool install git+https://github.com/the-canteen-dev/ARC-cli.git
17
+ ```
18
+
19
+ This places the binary at `~/.local/bin/arc-canteen`.
20
+
21
+ ## Upgrade
22
+
23
+ ```bash
24
+ uv tool install --reinstall git+https://github.com/the-canteen-dev/ARC-cli.git
25
+ ```
26
+
27
+ ## Commands
28
+
29
+ ### Top-level
30
+
31
+ | Command | Description |
32
+ |---|---|
33
+ | `arc-canteen` | Show your dashboard (default when no subcommand given) |
34
+ | `arc-canteen login` | Authenticate with GitHub and set up your profile |
35
+ | `arc-canteen logout` | Clear your local credentials |
36
+ | `arc-canteen status` | Show your dashboard |
37
+ | `arc-canteen push` | Push any queued local events to the server |
38
+ | `arc-canteen ls [traction\|product\|all]` | List all updates |
39
+ | `arc-canteen history [traction\|product\|all]` | Alias for `ls` |
40
+ | `arc-canteen profile-edit` | Shortcut for `arc-canteen profile edit` |
41
+ | `arc-canteen update-traction` | Shortcut for `arc-canteen update traction` |
42
+ | `arc-canteen update-product` | Shortcut for `arc-canteen update product` |
43
+ | `arc-canteen submit-puzzle` | Submit your answer to the current puzzle |
44
+ | `arc-canteen rpc <method> [params]` | JSON-RPC call to the configured Arc chain |
45
+ | `arc-canteen rpc-url [--export]` | Print the JSON-RPC URL with your token embedded |
46
+ | `arc-canteen rotate-rpc-key` | Mint a fresh token, update `config.yaml` + `$RPC`, invalidate the old one |
47
+ | `arc-canteen shell-init` | Print rc snippet that auto-loads `$RPC` in every shell |
48
+ | `arc-canteen context` | Dump agent context (AGENTS.md + paths to docs and samples) |
49
+ | `arc-canteen context sync` | Clone/pull developer docs + samples from context-arc |
50
+
51
+ ### `arc-canteen profile`
52
+
53
+ | Command | Description |
54
+ |---|---|
55
+ | `arc-canteen profile` | View your profile |
56
+ | `arc-canteen profile edit` | Edit your Discord handle, Telegram, and Luma email |
57
+
58
+ ### `arc-canteen update`
59
+
60
+ | Command | Description |
61
+ |---|---|
62
+ | `arc-canteen update` | Show recent updates |
63
+ | `arc-canteen update traction` | Submit a traction update |
64
+ | `arc-canteen update product` | Submit a product update |
65
+
66
+ ### Agent context
67
+
68
+ `arc-canteen context sync` clones [the-canteen-dev/context-arc](https://github.com/the-canteen-dev/context-arc) into `~/.arc-canteen/context/`. That repo bundles developer docs for Arc + Circle plus 5 sample codebases (as submodules). Subsequent `sync` invocations `git pull --recurse-submodules`.
69
+
70
+ `arc-canteen context` prints `AGENTS.md` plus a flat path manifest — pipe-friendly:
71
+
72
+ ```bash
73
+ arc-canteen context | claude # or aider / cody / cursor
74
+ arc-canteen context --paths # just the paths, no entry-point content
75
+ arc-canteen context --full # also inline every .md / .yaml
76
+ ```
77
+
78
+ ### JSON-RPC
79
+
80
+ Use `arc-canteen rpc <method> [params_json]` to make authenticated
81
+ JSON-RPC calls against the chain configured in `~/.arc-canteen/settings.yaml`.
82
+
83
+ ```bash
84
+ arc-canteen rpc eth_blockNumber # → 0x27a766a
85
+ arc-canteen rpc eth_chainId # → 0x4cef52
86
+ arc-canteen rpc eth_getBalance '["0xabc...", "latest"]' # → 0x1bc16d674...
87
+ arc-canteen rpc eth_call '[{"to":"0xabc","data":"0x70a08231"}, "latest"]'
88
+ arc-canteen rpc eth_sendRawTransaction '["0xf86c..."]'
89
+ arc-canteen rpc eth_blockNumber --raw # full envelope
90
+ ```
91
+
92
+ The proxy enforces a method allowlist; calls to disallowed methods
93
+ return `method '<x>' not allowed by the proxy`.
94
+
95
+ ### Auto-load $RPC
96
+
97
+ `arc-canteen login` writes `export RPC='<url>'` to `~/.arc-canteen/env`. To make every new shell pick it up, install one line:
98
+
99
+ ```bash
100
+ arc-canteen shell-init >> ~/.bashrc # or ~/.zshrc
101
+ ```
102
+
103
+ After that, `$RPC` is set in every shell with no per-session step.
104
+
105
+ ### Rotating your key
106
+
107
+ ```bash
108
+ arc-canteen rotate-rpc-key
109
+ ```
110
+
111
+ Mints a fresh token (re-auth via your stored GitHub credential — no browser
112
+ step), rewrites `~/.arc-canteen/config.yaml` and `~/.arc-canteen/env`, and
113
+ invalidates the old token server-side. Update anything that hard-coded the
114
+ old URL (a project `.env`, a CI secret) with the new one.
115
+
116
+ Tokens are good for 90 days; the dashboard nudges you as that approaches.
117
+ `arc-canteen logout` also invalidates the token server-side.
118
+
119
+ ## Local state
120
+
121
+ - `~/.arc-canteen/config.yaml` — auth (token + when it was issued) + profile + cached updates
122
+ - `~/.arc-canteen/settings.yaml` — chain + event_name
123
+ - `~/.arc-canteen/queue.yaml` — append-only event queue (synced to server)
124
+ - `~/.arc-canteen/env` — `export RPC='…'`; sourced by your shell rc
125
+
126
+ ## Server
127
+
128
+ The CLI talks to `https://arc-cli-server.thecanteenapp.com`. The server is intentionally idempotent — re-sending an event that already landed is harmless, so the local queue can be replayed at any time.
File without changes
@@ -0,0 +1,92 @@
1
+ """GitHub Device Flow OAuth for arc-canteen CLI."""
2
+
3
+ import httpx
4
+ import time
5
+ from rich.console import Console
6
+
7
+ console = Console()
8
+
9
+ GITHUB_CLIENT_ID = "Ov23liTpDFXKEw56hVH1"
10
+
11
+
12
+ def device_flow_login() -> dict:
13
+ """Run GitHub Device Flow. Returns token response dict with 'access_token'."""
14
+ try:
15
+ resp = httpx.post(
16
+ "https://github.com/login/device/code",
17
+ data={"client_id": GITHUB_CLIENT_ID, "scope": ""},
18
+ headers={"Accept": "application/json"},
19
+ timeout=10,
20
+ )
21
+ resp.raise_for_status()
22
+ except httpx.RequestError as e:
23
+ raise RuntimeError(f"Network error contacting GitHub: {e}")
24
+
25
+ data = resp.json()
26
+ if "error" in data:
27
+ raise RuntimeError(f"GitHub error: {data.get('error_description', data['error'])}")
28
+
29
+ device_code = data["device_code"]
30
+ user_code = data["user_code"]
31
+ verification_uri = data["verification_uri"]
32
+ interval = data.get("interval", 5)
33
+ expires_in = data.get("expires_in", 900)
34
+
35
+ console.print(f"\n [bold]1.[/bold] Open → [cyan]{verification_uri}[/cyan]")
36
+ console.print(f" [bold]2.[/bold] Enter → [bold yellow]{user_code}[/bold yellow]\n")
37
+
38
+ try:
39
+ import webbrowser
40
+ webbrowser.open(verification_uri)
41
+ except Exception:
42
+ pass
43
+
44
+ deadline = time.time() + expires_in
45
+ with console.status("[dim]Waiting for authorization...[/dim]"):
46
+ while time.time() < deadline:
47
+ time.sleep(interval)
48
+ try:
49
+ poll = httpx.post(
50
+ "https://github.com/login/oauth/access_token",
51
+ data={
52
+ "client_id": GITHUB_CLIENT_ID,
53
+ "device_code": device_code,
54
+ "grant_type": "urn:ietf:params:oauth:grant-type:device_code",
55
+ },
56
+ headers={"Accept": "application/json"},
57
+ timeout=10,
58
+ )
59
+ result = poll.json()
60
+ except httpx.RequestError:
61
+ continue
62
+
63
+ if "access_token" in result:
64
+ return result
65
+
66
+ err = result.get("error", "")
67
+ if err == "authorization_pending":
68
+ continue
69
+ elif err == "slow_down":
70
+ interval += 5
71
+ elif err == "expired_token":
72
+ raise RuntimeError("Code expired. Run `arc-canteen login` again.")
73
+ elif err == "access_denied":
74
+ raise RuntimeError("Authorization denied.")
75
+ else:
76
+ raise RuntimeError(f"Unexpected response: {result}")
77
+
78
+ raise RuntimeError("Authorization timed out.")
79
+
80
+
81
+ def get_github_user(token: str) -> dict:
82
+ resp = httpx.get(
83
+ "https://api.github.com/user",
84
+ headers={
85
+ "Authorization": f"Bearer {token}",
86
+ "Accept": "application/vnd.github+json",
87
+ "X-GitHub-Api-Version": "2022-11-28",
88
+ },
89
+ timeout=10,
90
+ )
91
+ resp.raise_for_status()
92
+ return resp.json()