sibyl-dev 1.4.0__tar.gz → 1.4.2__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.
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/.gitignore +2 -10
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/PKG-INFO +14 -9
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/README.md +12 -7
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/pyproject.toml +1 -1
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/auth_store.py +0 -16
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/client_transport.py +0 -23
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/config_store.py +1 -5
- sibyl_dev-1.4.2/src/sibyl_cli/connect.py +415 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/context.py +9 -1
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/data/skill-packs/core.md +0 -29
- sibyl_dev-1.4.2/src/sibyl_cli/data/skill-packs/migration.md +202 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/debug.py +73 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/docker.py +95 -19
- sibyl_dev-1.4.2/src/sibyl_cli/docker_storage.py +65 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/doctor.py +36 -18
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/host.py +1 -1
- sibyl_dev-1.4.2/src/sibyl_cli/local.py +1065 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/main.py +17 -1
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/migrate.py +72 -27
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/onboarding.py +0 -37
- sibyl_dev-1.4.2/src/sibyl_cli/project_scope.py +67 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/recall.py +21 -5
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/session.py +27 -12
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/setup.py +135 -20
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/skill.py +1 -1
- sibyl_dev-1.4.2/src/sibyl_cli/update.py +660 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/conftest.py +4 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_auth_login.py +10 -10
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_auth_store.py +0 -34
- sibyl_dev-1.4.2/tests/test_command_hints.py +304 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_context_pack.py +74 -0
- sibyl_dev-1.4.2/tests/test_debug.py +252 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_docker_runtime.py +172 -20
- sibyl_dev-1.4.2/tests/test_doctor.py +662 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_exit_codes.py +7 -6
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_local_surreal.py +29 -1
- sibyl_dev-1.4.2/tests/test_local_upgrade.py +645 -0
- sibyl_dev-1.4.2/tests/test_recall_project_scope.py +153 -0
- sibyl_dev-1.4.2/tests/test_server_url_independence.py +202 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_session.py +102 -19
- sibyl_dev-1.4.2/tests/test_setup_connect.py +707 -0
- sibyl_dev-1.4.2/tests/test_update.py +869 -0
- sibyl_dev-1.4.0/src/sibyl_cli/data/skill-packs/migration.md +0 -549
- sibyl_dev-1.4.0/src/sibyl_cli/docker_storage.py +0 -31
- sibyl_dev-1.4.0/src/sibyl_cli/local.py +0 -589
- sibyl_dev-1.4.0/src/sibyl_cli/update.py +0 -518
- sibyl_dev-1.4.0/tests/test_debug.py +0 -133
- sibyl_dev-1.4.0/tests/test_doctor.py +0 -341
- sibyl_dev-1.4.0/tests/test_onboarding.py +0 -17
- sibyl_dev-1.4.0/tests/test_update.py +0 -276
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/__init__.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/archive.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/auth.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/capture.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/capture_support.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/client.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/client_admin.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/client_auth.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/client_graph.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/client_memory.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/client_sources.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/client_work.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/command_support.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/common.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/config_cmd.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/context_quick.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/crawl.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/crawl_shared.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/data/hooks/session-start.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/data/skill-packs/contract.md +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/data/skill-packs/examples.md +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/data/skill-packs/quick.md +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/data/skill-packs/workflows.md +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/data/skills/sibyl/SKILL.md +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/dev.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/document.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/entity.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/entrypoint.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/epic.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/explore.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/export.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/id_resolution.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/ingest.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/logs.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/memory.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/memory_admin.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/memory_display.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/memory_review.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/memory_space.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/memory_views.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/org.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/pending.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/pending_identity.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/pending_writes.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/project.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/project_refs.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/root_commands.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/state.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/synthesis.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/task.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/team.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/version_drift.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/src/sibyl_cli/view_shared.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/__init__.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_archive.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_client_auth_refresh.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_client_contract.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_client_errors.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_common.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_config_store.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_docs.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_entity.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_entrypoint.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_epic.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_export_memory.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_host_runtime.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_id_resolution.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_ingest.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_init.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_logs.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_main_capture.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_main_search.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_org.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_packaged_data.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_pending_cli.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_pending_identity_store.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_pending_recovery.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_pending_visibility.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_pending_writes.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_project.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_resolver_is_single.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_skill.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_source.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_task.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_task_notes.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_update_server_axis.py +0 -0
- {sibyl_dev-1.4.0 → sibyl_dev-1.4.2}/tests/test_version_drift.py +0 -0
|
@@ -61,13 +61,9 @@ dmypy.json
|
|
|
61
61
|
.env.local
|
|
62
62
|
openrouter.key
|
|
63
63
|
|
|
64
|
-
#
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
# Kubernetes / Tilt
|
|
64
|
+
# Leftover local secrets from the retired Tilt stack. The directory is gone,
|
|
65
|
+
# but old checkouts may still hold real API keys here; never stage them.
|
|
68
66
|
infra/local/secrets.yaml
|
|
69
|
-
.tiltbuild/
|
|
70
|
-
tilt_modules/
|
|
71
67
|
|
|
72
68
|
# OS
|
|
73
69
|
.DS_Store
|
|
@@ -89,13 +85,9 @@ backups/
|
|
|
89
85
|
!apps/web/src/app/(main)/settings/admin/backups/
|
|
90
86
|
!apps/web/src/app/(main)/settings/admin/backups/page.tsx
|
|
91
87
|
*.sql
|
|
92
|
-
!docs/schemas/*.sql
|
|
93
88
|
|
|
94
89
|
# generated docs
|
|
95
90
|
docs/research/*
|
|
96
|
-
!docs/research/rust-port/
|
|
97
|
-
docs/research/rust-port/*
|
|
98
|
-
!docs/research/rust-port/INVENTORY.md
|
|
99
91
|
|
|
100
92
|
# Memory consolidation exports (dogfood archive tarballs kept on disk, not committed)
|
|
101
93
|
sibyl-consolidation/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: sibyl-dev
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.2
|
|
4
4
|
Summary: CLI for Sibyl knowledge graph and task workflow
|
|
5
5
|
Project-URL: Homepage, https://github.com/hyperb1iss/sibyl
|
|
6
6
|
Project-URL: Repository, https://github.com/hyperb1iss/sibyl
|
|
@@ -19,7 +19,7 @@ Requires-Dist: httpx>=0.27
|
|
|
19
19
|
Requires-Dist: packaging>=26.0
|
|
20
20
|
Requires-Dist: pyyaml>=6.0
|
|
21
21
|
Requires-Dist: rich>=13.0
|
|
22
|
-
Requires-Dist: sibyl-core==1.4.
|
|
22
|
+
Requires-Dist: sibyl-core==1.4.2
|
|
23
23
|
Requires-Dist: tomli-w>=1.2.0
|
|
24
24
|
Requires-Dist: typer>=0.27.1
|
|
25
25
|
Requires-Dist: websockets>=16.1.1
|
|
@@ -34,20 +34,24 @@ external assistants, and scripts. The package is published as `sibyl-dev`; the e
|
|
|
34
34
|
## Quick Reference
|
|
35
35
|
|
|
36
36
|
```bash
|
|
37
|
-
# Install
|
|
38
|
-
|
|
37
|
+
# Install and connect to a server: sign in, install the skill and the Claude Code hook
|
|
38
|
+
brew install hyperb1iss/tap/sibyl && sibyl setup https://sibyl.example.com # macOS
|
|
39
|
+
uv tool install --upgrade sibyl-dev && sibyl setup https://sibyl.example.com # anywhere with uv
|
|
40
|
+
|
|
41
|
+
# Or tell your agent: "Set up Sibyl on this machine by following https://sibyl.example.com/agent"
|
|
42
|
+
# (copy the exact sentence from the web app's Connect card; a server whose web app and API have
|
|
43
|
+
# separate origins uses /api/setup/agent.md on the API instead of /agent)
|
|
39
44
|
|
|
40
45
|
# Develop this package
|
|
41
46
|
moon run cli:install-dev
|
|
42
47
|
|
|
43
|
-
# Configure
|
|
44
|
-
sibyl init --remote https://sibyl.example.com
|
|
45
|
-
sibyl auth login
|
|
46
|
-
|
|
47
48
|
# Link to project (scopes all commands)
|
|
48
49
|
sibyl project link <project_id>
|
|
49
50
|
```
|
|
50
51
|
|
|
52
|
+
No uv yet? The shell installer bootstraps it, then runs `sibyl setup`:
|
|
53
|
+
`curl -fsSL https://raw.githubusercontent.com/hyperb1iss/sibyl/main/install.sh | sh -s -- --remote https://sibyl.example.com`.
|
|
54
|
+
|
|
51
55
|
## The Memory Loop
|
|
52
56
|
|
|
53
57
|
```bash
|
|
@@ -120,6 +124,7 @@ sibyl task complete <id> --learnings "..." # Complete with learnings
|
|
|
120
124
|
|
|
121
125
|
| Command | Purpose |
|
|
122
126
|
| ---------------- | ------------------------------------------------- |
|
|
127
|
+
| `setup` | Connect this machine to a server in one command |
|
|
123
128
|
| `show` | Resolve any entity or raw memory by ID |
|
|
124
129
|
| `health` | Check API connectivity and health |
|
|
125
130
|
| `doctor` | Diagnose CLI/server/auth/agent setup |
|
|
@@ -192,7 +197,7 @@ server) cleanly isolated: memories only ever go to the server of the context in
|
|
|
192
197
|
|
|
193
198
|
```bash
|
|
194
199
|
# Define two servers as contexts (auth login creates + activates one in one step)
|
|
195
|
-
sibyl auth login https://sibyl.
|
|
200
|
+
sibyl auth login https://sibyl.example.com -c personal
|
|
196
201
|
sibyl auth login http://localhost:3334 -c work
|
|
197
202
|
|
|
198
203
|
# Switch the global default
|
|
@@ -7,20 +7,24 @@ external assistants, and scripts. The package is published as `sibyl-dev`; the e
|
|
|
7
7
|
## Quick Reference
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
# Install
|
|
11
|
-
|
|
10
|
+
# Install and connect to a server: sign in, install the skill and the Claude Code hook
|
|
11
|
+
brew install hyperb1iss/tap/sibyl && sibyl setup https://sibyl.example.com # macOS
|
|
12
|
+
uv tool install --upgrade sibyl-dev && sibyl setup https://sibyl.example.com # anywhere with uv
|
|
13
|
+
|
|
14
|
+
# Or tell your agent: "Set up Sibyl on this machine by following https://sibyl.example.com/agent"
|
|
15
|
+
# (copy the exact sentence from the web app's Connect card; a server whose web app and API have
|
|
16
|
+
# separate origins uses /api/setup/agent.md on the API instead of /agent)
|
|
12
17
|
|
|
13
18
|
# Develop this package
|
|
14
19
|
moon run cli:install-dev
|
|
15
20
|
|
|
16
|
-
# Configure
|
|
17
|
-
sibyl init --remote https://sibyl.example.com
|
|
18
|
-
sibyl auth login
|
|
19
|
-
|
|
20
21
|
# Link to project (scopes all commands)
|
|
21
22
|
sibyl project link <project_id>
|
|
22
23
|
```
|
|
23
24
|
|
|
25
|
+
No uv yet? The shell installer bootstraps it, then runs `sibyl setup`:
|
|
26
|
+
`curl -fsSL https://raw.githubusercontent.com/hyperb1iss/sibyl/main/install.sh | sh -s -- --remote https://sibyl.example.com`.
|
|
27
|
+
|
|
24
28
|
## The Memory Loop
|
|
25
29
|
|
|
26
30
|
```bash
|
|
@@ -93,6 +97,7 @@ sibyl task complete <id> --learnings "..." # Complete with learnings
|
|
|
93
97
|
|
|
94
98
|
| Command | Purpose |
|
|
95
99
|
| ---------------- | ------------------------------------------------- |
|
|
100
|
+
| `setup` | Connect this machine to a server in one command |
|
|
96
101
|
| `show` | Resolve any entity or raw memory by ID |
|
|
97
102
|
| `health` | Check API connectivity and health |
|
|
98
103
|
| `doctor` | Diagnose CLI/server/auth/agent setup |
|
|
@@ -165,7 +170,7 @@ server) cleanly isolated: memories only ever go to the server of the context in
|
|
|
165
170
|
|
|
166
171
|
```bash
|
|
167
172
|
# Define two servers as contexts (auth login creates + activates one in one step)
|
|
168
|
-
sibyl auth login https://sibyl.
|
|
173
|
+
sibyl auth login https://sibyl.example.com -c personal
|
|
169
174
|
sibyl auth login http://localhost:3334 -c work
|
|
170
175
|
|
|
171
176
|
# Switch the global default
|
|
@@ -435,19 +435,3 @@ def clear_all_tokens(path: Path | None = None) -> None:
|
|
|
435
435
|
with auth_file_lock(path):
|
|
436
436
|
if p.exists():
|
|
437
437
|
p.unlink()
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
def migrate_legacy_tokens(path: Path | None = None) -> None:
|
|
441
|
-
"""Remove legacy root-level tokens (one-time cleanup)."""
|
|
442
|
-
data = read_auth_data(path)
|
|
443
|
-
|
|
444
|
-
# Check if there are legacy root-level tokens to remove
|
|
445
|
-
if not data.get("access_token"):
|
|
446
|
-
return # Nothing to migrate
|
|
447
|
-
|
|
448
|
-
# Remove legacy fields
|
|
449
|
-
data.pop("access_token", None)
|
|
450
|
-
data.pop("refresh_token", None)
|
|
451
|
-
data.pop("access_token_expires_at", None)
|
|
452
|
-
|
|
453
|
-
write_auth_data(data, path)
|
|
@@ -959,26 +959,3 @@ class ClientTransportMixin:
|
|
|
959
959
|
) -> dict[str, Any]:
|
|
960
960
|
"""Generic DELETE request."""
|
|
961
961
|
return await self._request("DELETE", path, json=json, params=params)
|
|
962
|
-
|
|
963
|
-
async def _request_any(
|
|
964
|
-
self,
|
|
965
|
-
method: str,
|
|
966
|
-
paths: list[str],
|
|
967
|
-
*,
|
|
968
|
-
json: dict[str, Any] | None = None,
|
|
969
|
-
params: dict[str, Any] | None = None,
|
|
970
|
-
) -> dict[str, Any]:
|
|
971
|
-
"""Try multiple paths, falling back when an endpoint is not found."""
|
|
972
|
-
last_error: SibylClientError | None = None
|
|
973
|
-
for path in paths:
|
|
974
|
-
try:
|
|
975
|
-
return await self._request(method, path, json=json, params=params)
|
|
976
|
-
except SibylClientError as e:
|
|
977
|
-
if e.status_code == 404:
|
|
978
|
-
last_error = e
|
|
979
|
-
continue
|
|
980
|
-
raise
|
|
981
|
-
|
|
982
|
-
if last_error:
|
|
983
|
-
raise last_error
|
|
984
|
-
raise SibylClientError("No API path candidates provided")
|
|
@@ -11,17 +11,13 @@ from __future__ import annotations
|
|
|
11
11
|
|
|
12
12
|
import os
|
|
13
13
|
import tempfile
|
|
14
|
+
import tomllib
|
|
14
15
|
from collections.abc import Callable, Iterator
|
|
15
16
|
from contextlib import contextmanager, suppress
|
|
16
17
|
from dataclasses import dataclass
|
|
17
18
|
from pathlib import Path
|
|
18
19
|
from typing import Any
|
|
19
20
|
|
|
20
|
-
try:
|
|
21
|
-
import tomllib
|
|
22
|
-
except ImportError:
|
|
23
|
-
import tomli as tomllib
|
|
24
|
-
|
|
25
21
|
import tomli_w
|
|
26
22
|
|
|
27
23
|
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
"""`sibyl setup`: connect this machine to a Sibyl server in one command.
|
|
2
|
+
|
|
3
|
+
Every install path ends here (Homebrew, uv, the curl installer, and the agent
|
|
4
|
+
setup document), so this is the one implementation of the steps: pick a
|
|
5
|
+
context for the server, sign in, install the skill, add the Claude Code hook,
|
|
6
|
+
and verify. Each step checks first and skips work that is already done.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import ipaddress
|
|
12
|
+
import os
|
|
13
|
+
import shlex
|
|
14
|
+
import shutil
|
|
15
|
+
import sys
|
|
16
|
+
from collections.abc import Iterator
|
|
17
|
+
from contextlib import contextmanager
|
|
18
|
+
from dataclasses import dataclass
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
from typing import Annotated
|
|
21
|
+
from urllib.parse import urlsplit, urlunsplit
|
|
22
|
+
|
|
23
|
+
import httpx
|
|
24
|
+
import typer
|
|
25
|
+
|
|
26
|
+
from sibyl_cli import config_store, doctor, setup
|
|
27
|
+
from sibyl_cli.auth import _login_auto
|
|
28
|
+
from sibyl_cli.auth_store import credential_scope, normalize_api_url
|
|
29
|
+
from sibyl_cli.client import SibylClient, SibylClientError, clear_client_cache
|
|
30
|
+
from sibyl_cli.client_transport import _paired_automation_api_url
|
|
31
|
+
from sibyl_cli.common import ELECTRIC_PURPLE, NEON_CYAN, console, error, run_async, warn
|
|
32
|
+
from sibyl_cli.skill import install_canonical_skill
|
|
33
|
+
from sibyl_cli.version_drift import client_version
|
|
34
|
+
from sibyl_core.integration import (
|
|
35
|
+
BREW_FORMULA,
|
|
36
|
+
LOGIN_TIMEOUT_MINUTES,
|
|
37
|
+
UV_INSTALL_COMMAND,
|
|
38
|
+
is_clean_server_url,
|
|
39
|
+
)
|
|
40
|
+
from sibyl_core.version_contract import (
|
|
41
|
+
MIN_CLIENT_HEADER,
|
|
42
|
+
SERVER_VERSION_HEADER,
|
|
43
|
+
client_is_below_floor,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
LOCAL_HOSTS = {"localhost", "127.0.0.1", "::1"}
|
|
47
|
+
FIRST_TRY = 'sibyl context "what\'s in flight"'
|
|
48
|
+
HOOK_PURPOSE = "a Claude Code SessionStart hook that loads your active tasks and recent memory"
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@dataclass(frozen=True)
|
|
52
|
+
class Step:
|
|
53
|
+
label: str
|
|
54
|
+
ok: bool
|
|
55
|
+
detail: str
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _print_step(step: Step) -> None:
|
|
59
|
+
mark = "[green]✓[/green]" if step.ok else "[red]✗[/red]"
|
|
60
|
+
console.print(f" {mark} {step.label:<10} [dim]{step.detail}[/dim]")
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def normalize_server_url(raw: str) -> str:
|
|
64
|
+
"""Accept what people paste: a web URL, an API URL, or a trailing slash."""
|
|
65
|
+
text = raw.strip()
|
|
66
|
+
if "://" not in text:
|
|
67
|
+
text = f"https://{text}"
|
|
68
|
+
parts = urlsplit(text)
|
|
69
|
+
if parts.scheme not in {"http", "https"} or not parts.netloc:
|
|
70
|
+
raise typer.BadParameter(f"Not a server URL: {raw}")
|
|
71
|
+
path = parts.path.rstrip("/").removesuffix("/api")
|
|
72
|
+
url = urlunsplit((parts.scheme, parts.netloc, path, "", ""))
|
|
73
|
+
if not is_clean_server_url(url):
|
|
74
|
+
raise typer.BadParameter(f"Not a plain http(s) server URL: {raw}")
|
|
75
|
+
return url
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def is_loopback(server_url: str) -> bool:
|
|
79
|
+
"""True for localhost, 127.0.0.0/8 and ::1, the only hosts plain http may reach."""
|
|
80
|
+
host = (urlsplit(server_url).hostname or "").lower()
|
|
81
|
+
if host == "localhost":
|
|
82
|
+
return True
|
|
83
|
+
try:
|
|
84
|
+
return ipaddress.ip_address(host).is_loopback
|
|
85
|
+
except ValueError:
|
|
86
|
+
return False
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def upgrade_command() -> str:
|
|
90
|
+
"""How to upgrade this CLI, matched to how it was installed."""
|
|
91
|
+
prefix = Path(sys.prefix).as_posix().lower()
|
|
92
|
+
if "/cellar/" in prefix or "homebrew" in prefix or "linuxbrew" in prefix:
|
|
93
|
+
return f"brew upgrade {BREW_FORMULA}"
|
|
94
|
+
return UV_INSTALL_COMMAND
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def interactive() -> bool:
|
|
98
|
+
return sys.stdin.isatty() and sys.stdout.isatty()
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def probe_server(server_url: str, *, insecure: bool) -> tuple[str | None, str | None]:
|
|
102
|
+
"""Return the server's version and version floor from its public health route."""
|
|
103
|
+
response = httpx.get(
|
|
104
|
+
f"{server_url}/api/health", timeout=10, verify=not insecure, follow_redirects=True
|
|
105
|
+
)
|
|
106
|
+
response.raise_for_status()
|
|
107
|
+
body = response.json() if response.content else {}
|
|
108
|
+
version = response.headers.get(SERVER_VERSION_HEADER) or body.get("version")
|
|
109
|
+
return version, response.headers.get(MIN_CLIENT_HEADER)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def _matching_contexts(server_url: str, name: str | None) -> list[config_store.Context]:
|
|
113
|
+
target = normalize_api_url(f"{server_url}/api")
|
|
114
|
+
return [
|
|
115
|
+
ctx
|
|
116
|
+
for ctx in config_store.list_contexts()
|
|
117
|
+
if normalize_api_url(f"{ctx.server_url.rstrip('/')}/api") == target
|
|
118
|
+
and (name is None or ctx.name == name)
|
|
119
|
+
]
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def _existing_context(server_url: str, name: str | None) -> config_store.Context | None:
|
|
123
|
+
"""The context already pointing at `server_url`, preferring the selected one."""
|
|
124
|
+
matches = _matching_contexts(server_url, name)
|
|
125
|
+
if not matches:
|
|
126
|
+
return None
|
|
127
|
+
current = config_store.resolve_context_name()
|
|
128
|
+
return next((ctx for ctx in matches if ctx.name == current), matches[0])
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
def _new_context_name(server_url: str, name: str | None) -> str:
|
|
132
|
+
"""Name a new context after the server, adding the port when the plain name is taken."""
|
|
133
|
+
if name:
|
|
134
|
+
candidates = [name]
|
|
135
|
+
else:
|
|
136
|
+
parts = urlsplit(server_url)
|
|
137
|
+
host = parts.hostname or "remote"
|
|
138
|
+
base = "local" if host in LOCAL_HOSTS else host
|
|
139
|
+
candidates = [base, f"{base}-{parts.port}"] if parts.port else [base]
|
|
140
|
+
for candidate in candidates:
|
|
141
|
+
if config_store.get_context(candidate) is None:
|
|
142
|
+
return candidate
|
|
143
|
+
error(f"Context '{candidates[-1]}' already points at another server.")
|
|
144
|
+
console.print(f" Name a new one: sibyl setup {shlex.quote(server_url)} --context <name>")
|
|
145
|
+
raise typer.Exit(1)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def _activate(ctx: config_store.Context, *, created: bool) -> str:
|
|
149
|
+
"""Make `ctx` the active context once sign-in worked; returns the checklist detail."""
|
|
150
|
+
if created:
|
|
151
|
+
config_store.set_active_context(ctx.name)
|
|
152
|
+
clear_client_cache()
|
|
153
|
+
return f"{ctx.name} (created, active)"
|
|
154
|
+
if ctx.name == config_store.resolve_context_name():
|
|
155
|
+
return f"{ctx.name} (active)"
|
|
156
|
+
config_store.set_active_context(ctx.name)
|
|
157
|
+
clear_client_cache()
|
|
158
|
+
return f"{ctx.name} (now active)"
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def _warn_if_pinned_elsewhere(ctx: config_store.Context) -> None:
|
|
162
|
+
"""A -C flag, SIBYL_CONTEXT, or directory pin outranks the active context."""
|
|
163
|
+
selected = config_store.resolve_context_name()
|
|
164
|
+
if selected and selected != ctx.name:
|
|
165
|
+
warn(
|
|
166
|
+
f"This shell selects context '{selected}' (via -C, SIBYL_CONTEXT, or a directory "
|
|
167
|
+
f"pin), so other commands here still use it. Switch with: sibyl -C {ctx.name} ..."
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
@contextmanager
|
|
172
|
+
def only_target_credentials(server_url: str) -> Iterator[None]:
|
|
173
|
+
"""Keep an automation token away from a server it was not issued for.
|
|
174
|
+
|
|
175
|
+
SIBYL_AUTH_TOKEN wins over stored logins, and without a paired
|
|
176
|
+
SIBYL_API_URL the client sends it to whatever server a command targets.
|
|
177
|
+
For the length of setup it stays in play only when SIBYL_API_URL names
|
|
178
|
+
this same server, so every request setup makes authenticates with the
|
|
179
|
+
target's own stored login or with nothing.
|
|
180
|
+
"""
|
|
181
|
+
token = os.environ.get("SIBYL_AUTH_TOKEN", "").strip()
|
|
182
|
+
paired = _paired_automation_api_url()
|
|
183
|
+
target = normalize_api_url(f"{server_url}/api")
|
|
184
|
+
if not token or (paired and normalize_api_url(paired) == target):
|
|
185
|
+
yield
|
|
186
|
+
return
|
|
187
|
+
warn(
|
|
188
|
+
"SIBYL_AUTH_TOKEN is set for another server and was not sent here. Other "
|
|
189
|
+
"commands in this shell still send it; unset it to use this login."
|
|
190
|
+
)
|
|
191
|
+
saved = os.environ.pop("SIBYL_AUTH_TOKEN")
|
|
192
|
+
clear_client_cache()
|
|
193
|
+
try:
|
|
194
|
+
yield
|
|
195
|
+
finally:
|
|
196
|
+
os.environ["SIBYL_AUTH_TOKEN"] = saved
|
|
197
|
+
clear_client_cache()
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
def whoami(ctx: config_store.Context) -> str | None:
|
|
201
|
+
"""Who the saved credentials sign in as, or None when there is no valid login."""
|
|
202
|
+
client = SibylClient(context_name=ctx.name)
|
|
203
|
+
|
|
204
|
+
@run_async
|
|
205
|
+
async def _me() -> dict:
|
|
206
|
+
try:
|
|
207
|
+
return await client.get("/auth/me")
|
|
208
|
+
finally:
|
|
209
|
+
await client.close()
|
|
210
|
+
|
|
211
|
+
try:
|
|
212
|
+
me = _me()
|
|
213
|
+
except SibylClientError:
|
|
214
|
+
return None
|
|
215
|
+
user = me.get("user") or {}
|
|
216
|
+
return str(user.get("email") or user.get("name") or "signed in")
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def login(ctx: config_store.Context) -> None:
|
|
220
|
+
api_url = normalize_api_url(f"{ctx.server_url}/api")
|
|
221
|
+
_login_auto(
|
|
222
|
+
api_url=api_url,
|
|
223
|
+
no_browser=False,
|
|
224
|
+
timeout_seconds=LOGIN_TIMEOUT_MINUTES * 60,
|
|
225
|
+
email=None,
|
|
226
|
+
password=None,
|
|
227
|
+
insecure=ctx.insecure,
|
|
228
|
+
credential_scope_name=credential_scope(ctx.name, ctx.org_slug),
|
|
229
|
+
)
|
|
230
|
+
clear_client_cache()
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def sign_in(ctx: config_store.Context) -> str | None:
|
|
234
|
+
"""The signed-in identity, running the browser login when there is none yet."""
|
|
235
|
+
identity = whoami(ctx)
|
|
236
|
+
if identity is not None:
|
|
237
|
+
return identity
|
|
238
|
+
console.print("\n Opening your browser to sign in. Approve the code there.")
|
|
239
|
+
try:
|
|
240
|
+
login(ctx)
|
|
241
|
+
except typer.Exit:
|
|
242
|
+
# The login already printed why; setup reports the failed step.
|
|
243
|
+
return None
|
|
244
|
+
console.print()
|
|
245
|
+
return whoami(ctx)
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
def ensure_skill() -> Step:
|
|
249
|
+
if doctor._check_skill_stub().status == "pass":
|
|
250
|
+
return Step("Skill", True, "already installed")
|
|
251
|
+
install_canonical_skill()
|
|
252
|
+
check = doctor._check_skill_stub()
|
|
253
|
+
if check.status == "fail":
|
|
254
|
+
return Step("Skill", False, check.message)
|
|
255
|
+
return Step("Skill", True, "installed for Claude Code, Codex, and other agents")
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
def claude_code_present() -> bool:
|
|
259
|
+
# Not ~/.claude alone: installing the skill creates that directory itself.
|
|
260
|
+
home = Path.home()
|
|
261
|
+
return (
|
|
262
|
+
shutil.which("claude") is not None
|
|
263
|
+
or (home / ".claude.json").exists()
|
|
264
|
+
or (home / ".claude" / "settings.json").exists()
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
def ensure_hook() -> Step:
|
|
269
|
+
"""Register the Claude Code SessionStart hook; other agents have no hook."""
|
|
270
|
+
if not claude_code_present():
|
|
271
|
+
return Step("Hook", True, "skipped: Claude Code not found, other agents need none")
|
|
272
|
+
check = doctor._check_session_hook()
|
|
273
|
+
script = setup.CLAUDE_HOOKS_DIR / "session-start.py"
|
|
274
|
+
if check.status == "pass" and script.exists():
|
|
275
|
+
return Step("Hook", True, "already registered")
|
|
276
|
+
unreadable = f"{setup.CLAUDE_SETTINGS_FILE} is not valid Claude settings; left unchanged"
|
|
277
|
+
if check.status == "fail":
|
|
278
|
+
return Step("Hook", False, unreadable)
|
|
279
|
+
data_dir = setup.get_package_data_dir()
|
|
280
|
+
if data_dir is None or not setup.install_hooks_copy(data_dir):
|
|
281
|
+
return Step("Hook", False, "hook script missing from this CLI package")
|
|
282
|
+
if not setup.configure_claude_hooks():
|
|
283
|
+
return Step("Hook", False, unreadable)
|
|
284
|
+
return Step("Hook", True, "Claude Code SessionStart")
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
def setup_cmd(
|
|
288
|
+
url: Annotated[
|
|
289
|
+
str | None,
|
|
290
|
+
typer.Argument(help="Server URL, e.g. https://sibyl.example.com (default: current server)"),
|
|
291
|
+
] = None,
|
|
292
|
+
yes: Annotated[
|
|
293
|
+
bool, typer.Option("--yes", "-y", help="Don't ask; for agents and scripts")
|
|
294
|
+
] = False,
|
|
295
|
+
context: Annotated[
|
|
296
|
+
str | None,
|
|
297
|
+
typer.Option("--context", "-c", help="Context name to use or create for this server"),
|
|
298
|
+
] = None,
|
|
299
|
+
no_hooks: Annotated[
|
|
300
|
+
bool, typer.Option("--no-hooks", help="Skip the Claude Code SessionStart hook")
|
|
301
|
+
] = False,
|
|
302
|
+
insecure: Annotated[
|
|
303
|
+
bool,
|
|
304
|
+
typer.Option(
|
|
305
|
+
"--insecure",
|
|
306
|
+
"-k",
|
|
307
|
+
help="Skip TLS verification, and allow plain http to a host that is not this machine",
|
|
308
|
+
),
|
|
309
|
+
] = False,
|
|
310
|
+
) -> None:
|
|
311
|
+
"""Connect this machine to a Sibyl server: sign in, install the skill and hooks."""
|
|
312
|
+
# Without a URL, set up whatever server the CLI already talks to: the
|
|
313
|
+
# selected context, or the local default.
|
|
314
|
+
server_url = normalize_server_url(url or config_store.get_effective_server_url())
|
|
315
|
+
with only_target_credentials(server_url):
|
|
316
|
+
_run_setup(
|
|
317
|
+
server_url,
|
|
318
|
+
from_url=bool(url),
|
|
319
|
+
yes=yes,
|
|
320
|
+
context=context,
|
|
321
|
+
no_hooks=no_hooks,
|
|
322
|
+
insecure=insecure,
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
def _run_setup(
|
|
327
|
+
server_url: str,
|
|
328
|
+
*,
|
|
329
|
+
from_url: bool,
|
|
330
|
+
yes: bool,
|
|
331
|
+
context: str | None,
|
|
332
|
+
no_hooks: bool,
|
|
333
|
+
insecure: bool,
|
|
334
|
+
) -> None:
|
|
335
|
+
|
|
336
|
+
console.print()
|
|
337
|
+
console.print(f"[{ELECTRIC_PURPLE}]◈[/{ELECTRIC_PURPLE}] [bold]Sibyl setup[/bold] {server_url}")
|
|
338
|
+
console.print()
|
|
339
|
+
|
|
340
|
+
# Sign-in sends a password or a token over this connection.
|
|
341
|
+
if server_url.startswith("http://") and not insecure and not is_loopback(server_url):
|
|
342
|
+
_print_step(Step("Server", False, "plain http to another machine would expose sign-in"))
|
|
343
|
+
console.print(
|
|
344
|
+
"\n Use the https URL, or pass --insecure to allow http on a network you trust."
|
|
345
|
+
)
|
|
346
|
+
raise typer.Exit(1)
|
|
347
|
+
|
|
348
|
+
if not yes and interactive():
|
|
349
|
+
hook = "" if no_hooks else f", and add {HOOK_PURPOSE}"
|
|
350
|
+
console.print(
|
|
351
|
+
f" Connects this CLI, signs you in, installs the Sibyl skill for your agents{hook}."
|
|
352
|
+
)
|
|
353
|
+
if not typer.confirm(" Continue?", default=True):
|
|
354
|
+
raise typer.Exit(1)
|
|
355
|
+
console.print()
|
|
356
|
+
|
|
357
|
+
# TLS trust comes from the flag or the chosen context's own setting, never
|
|
358
|
+
# from a sibling context that happens to point at the same server.
|
|
359
|
+
existing = _existing_context(server_url, context)
|
|
360
|
+
skip_verify = insecure or bool(existing and existing.insecure)
|
|
361
|
+
try:
|
|
362
|
+
version, minimum = probe_server(server_url, insecure=skip_verify)
|
|
363
|
+
except (httpx.HTTPError, ValueError) as exc:
|
|
364
|
+
_print_step(Step("Server", False, f"unreachable: {exc}"))
|
|
365
|
+
if not from_url:
|
|
366
|
+
console.print("\n Pass the server to connect to: sibyl setup https://your-sibyl-host")
|
|
367
|
+
raise typer.Exit(1) from exc
|
|
368
|
+
current = client_version()
|
|
369
|
+
if client_is_below_floor(client=current, minimum=minimum):
|
|
370
|
+
_print_step(Step("Server", False, f"needs sibyl {minimum}+, this CLI is {current}"))
|
|
371
|
+
console.print(f"\n Upgrade, then re-run: [{NEON_CYAN}]{upgrade_command()}[/{NEON_CYAN}]")
|
|
372
|
+
raise typer.Exit(1)
|
|
373
|
+
_print_step(Step("Server", True, f"sibyl {version or 'unknown version'}"))
|
|
374
|
+
|
|
375
|
+
# A new context stays inactive until sign-in works, and is removed if it
|
|
376
|
+
# does not, so a failed setup never leaves the CLI pointed at a server it
|
|
377
|
+
# cannot talk to.
|
|
378
|
+
created = existing is None
|
|
379
|
+
if existing is None:
|
|
380
|
+
ctx = config_store.create_context(
|
|
381
|
+
_new_context_name(server_url, context), server_url=server_url, insecure=insecure
|
|
382
|
+
)
|
|
383
|
+
elif insecure and not existing.insecure:
|
|
384
|
+
ctx = config_store.update_context(existing.name, insecure=True)
|
|
385
|
+
else:
|
|
386
|
+
ctx = existing
|
|
387
|
+
clear_client_cache()
|
|
388
|
+
|
|
389
|
+
identity = sign_in(ctx)
|
|
390
|
+
_print_step(Step("Signed in", identity is not None, identity or "sign-in did not complete"))
|
|
391
|
+
if identity is None:
|
|
392
|
+
if created:
|
|
393
|
+
config_store.delete_context(ctx.name)
|
|
394
|
+
clear_client_cache()
|
|
395
|
+
console.print()
|
|
396
|
+
error("Setup is incomplete. Sign in, then re-run this command.")
|
|
397
|
+
raise typer.Exit(1)
|
|
398
|
+
|
|
399
|
+
context_detail = _activate(ctx, created=created)
|
|
400
|
+
if insecure and not (existing and existing.insecure):
|
|
401
|
+
context_detail += ", skips TLS verification"
|
|
402
|
+
_print_step(Step("Context", True, context_detail))
|
|
403
|
+
_warn_if_pinned_elsewhere(ctx)
|
|
404
|
+
|
|
405
|
+
steps = [ensure_skill()]
|
|
406
|
+
if not no_hooks:
|
|
407
|
+
steps.append(ensure_hook())
|
|
408
|
+
for step in steps:
|
|
409
|
+
_print_step(step)
|
|
410
|
+
|
|
411
|
+
console.print()
|
|
412
|
+
if not all(step.ok for step in steps):
|
|
413
|
+
error("Setup is incomplete. Fix the step above, then re-run this command.")
|
|
414
|
+
raise typer.Exit(1)
|
|
415
|
+
console.print(f" Try it: [{NEON_CYAN}]{FIRST_TRY}[/{NEON_CYAN}]")
|
|
@@ -50,6 +50,7 @@ from sibyl_cli.project_refs import (
|
|
|
50
50
|
list_accessible_projects,
|
|
51
51
|
matching_project_refs,
|
|
52
52
|
)
|
|
53
|
+
from sibyl_cli.project_scope import ALL_PROJECTS_SCOPE, resolve_recall_project
|
|
53
54
|
|
|
54
55
|
CONTEXT_PACK_PREVIEW_CHARS = 320
|
|
55
56
|
|
|
@@ -470,7 +471,12 @@ def pack_cmd(
|
|
|
470
471
|
] = None,
|
|
471
472
|
) -> None:
|
|
472
473
|
"""Compile a precise context pack for an agent."""
|
|
473
|
-
effective_project =
|
|
474
|
+
effective_project = resolve_recall_project(
|
|
475
|
+
project,
|
|
476
|
+
all_projects,
|
|
477
|
+
resolve_linked=resolve_project_from_cwd,
|
|
478
|
+
resolve_context=resolve_effective_context,
|
|
479
|
+
)
|
|
474
480
|
|
|
475
481
|
@run_async
|
|
476
482
|
async def _run() -> None:
|
|
@@ -509,6 +515,8 @@ def pack_cmd(
|
|
|
509
515
|
console.print(f" [{NEON_CYAN}]Domain:[/{NEON_CYAN}] {pack['domain']}")
|
|
510
516
|
if pack.get("project"):
|
|
511
517
|
console.print(f" [{NEON_CYAN}]Project:[/{NEON_CYAN}] {pack['project']}")
|
|
518
|
+
elif pack.get("scope") == ALL_PROJECTS_SCOPE:
|
|
519
|
+
console.print(f" [{CORAL}]Scope:[/{CORAL}] all accessible projects")
|
|
512
520
|
console.print(f" [dim]{pack.get('total_items', 0)} item(s)[/dim]")
|
|
513
521
|
console.print()
|
|
514
522
|
|