Skip to content

Commit 42b6d10

Browse files
committed
refactor: disable AI provider settings and remove first-run onboarding UI logic
1 parent 5e0f6e0 commit 42b6d10

47 files changed

Lines changed: 4786 additions & 622 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 55 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,21 @@ k10s --version # which build is this
120120

121121
### Every resource, grouped the way you think about them
122122

123-
16 kinds across **Workloads · Network · Config · Storage · Cluster · Custom
124-
Resources**, each with a live row count for the current namespace. Your CRDs
125-
are discovered automatically - no configuration.
126-
127-
Pods · Deployments · StatefulSets · DaemonSets · Jobs · CronJobs · Services ·
128-
Ingresses · ConfigMaps · Secrets · PVCs · Nodes · Namespaces · Events · CRDs ·
129-
Custom Resources
123+
30 kinds across **Workloads · Network · Config · Storage · RBAC · Cluster ·
124+
Custom Resources**, each with a live row count for the current namespace.
125+
Your CRDs are discovered automatically - no configuration.
126+
127+
Groups fold: `space`, `left` or a click on the header, remembered across
128+
restarts, with Config/Storage/RBAC folded to begin with. A folded group also
129+
asks your cluster for nothing - the sidebar is what decides which kinds get
130+
counted, and counting is one `limit=1` request per *visible* kind, six at a
131+
time, with refusals remembered.
132+
133+
Pods · Deployments · ReplicaSets · StatefulSets · DaemonSets · Jobs ·
134+
CronJobs · HPAs · Services · Endpoints · Ingresses · NetworkPolicies ·
135+
ConfigMaps · Secrets · ResourceQuotas · LimitRanges · PDBs · PVCs · PVs ·
136+
StorageClasses · ServiceAccounts · Roles · RoleBindings · ClusterRoles ·
137+
ClusterRoleBindings · Nodes · Namespaces · Events · CRDs · Custom Resources
130138

131139
### The whole day-2 toolkit, on single keys
132140

@@ -194,8 +202,8 @@ path, so [adding a theme is one struct](docs/themes.md).
194202
- **An honest loading state** instead of "no resources found" while a watch
195203
is still syncing.
196204
- **Namespace and context pickers that never ask you to type a name.**
197-
- **First-run onboarding** asks what you call kubectl (`kubectl`/`k8s`/`k`/
198-
your own alias) and uses it in every hint from then on.
205+
- **No setup screen.** First run opens the cluster; every setting has a
206+
working default and `/settings` is one keystroke away when you want it.
199207
- **A grow-able prompt** (`ctrl+z`) - because a long kubectl line or an AI
200208
question does not fit in a one-row field that scrolls sideways.
201209
- **A terminal-too-small notice** instead of a garbled layout.
@@ -244,22 +252,51 @@ The short version - the [full reference is here](docs/keybindings.md).
244252

245253
## Commands
246254

247-
Two prefixes, and each one only ever shows its own set. **`/` does
248-
something. `:` narrows what is on screen.** `enter` runs the highlighted
249-
suggestion immediately - no second trip through the prompt.
255+
Two prefixes, and each one only ever shows its own set. **`/` is k10s itself
256+
(theme, settings, updates). `:` is the cluster, in the k9s vocabulary** - a
257+
resource view, the namespace, the context, or something acting on what is on
258+
screen. `enter` runs the highlighted suggestion immediately - no second trip
259+
through the prompt.
250260

251261
```
252-
/ns /context /theme /settings /update /version /help
253-
:search <term> :filter <term> :scale <n> :mouse
262+
/theme /settings /update /version /help k10s itself
263+
264+
:po :deploy :rs :sts :ds :job :cj :hpa workloads
265+
:svc :ep :ing :netpol network
266+
:cm :sec :quota :limits :pdb config
267+
:pvc :pv :sc storage
268+
:sa :role :rb :crole :crb rbac
269+
:no :ns :ev :crd :cr cluster + custom
270+
271+
the short form is what the popup lists; every kind also answers to its
272+
plural and singular - :pods, :pod, :deployments, :persistentvolumes ...
273+
and `:aliases` prints the lot
274+
275+
:po kube-system that kind, in that namespace (`all` works)
276+
:svc api an argument that is not a namespace filters
277+
:ns :ctx namespace / context picker
278+
:ns <name> :ctx <name> switch either outright
279+
:aliases :search <term> :filter <term> :scale <n> :mouse :q
254280
```
255281

256-
None of `/ns`, `/context` or `/theme` takes a name - each opens a chooser
257-
showing what actually exists. [Full command reference](docs/commands.md).
282+
**`/` is k10s, `:` is the cluster** - namespace and context are `:ns` and
283+
`:ctx`, not `/ns` and `/context`. `:aliases` prints the whole `:` vocabulary.
284+
285+
Anything that is not a `/` or `:` command **runs as a shell command** and its
286+
output opens in the main panel - `date`, `kubectl get pods -o wide`,
287+
`helm list`. Run through your own `$SHELL`, capped at 30s, with no terminal
288+
attached (use `s` on a pod for an interactive shell).
289+
[Full command reference](docs/commands.md).
258290

259291
## Config
260292

261-
Theme, context, namespace, AI settings and the update check persist to
262-
`~/.k10s/config.yaml` (override with `K10S_CONFIG`), saved on every change.
293+
k10s opens on **kubeconfig's current-context** — the cluster `kubectl` would
294+
talk to. `:ctx <name>` switches for the session without touching kubeconfig;
295+
`kubectl config use-context` is what changes where it opens next time.
296+
297+
Theme, namespace, folded sidebar groups, AI settings and the update check
298+
persist to `~/.k10s/config.yaml` (override with `K10S_CONFIG`), saved on
299+
every change.
263300
See [config.md](docs/config.md).
264301

265302
> **Note:** the AI API key is stored as plain text in that file (mode 0600)

docs/architecture.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,17 @@ internal/ui/
1818
model.go Model state, Update: key/mouse dispatch, async commands
1919
view.go View: header, list, table/text, actions, prompt
2020
actions.go the action table (id, hotkey, label, risky)
21-
commands.go slash commands + /help text
21+
commands.go "/" and ":" commands, kind aliases, /help text
22+
shellcmd.go plain text at the prompt → a shell command
2223
msgs.go async result messages
2324
connect.go startup: pendingSource + the background connect
2425
update.go /update + /version: the check, the confirm, the install
25-
pickers.go/_view.go onboarding + theme picker
26+
pickers.go/_view.go theme picker
2627
palette.go/_view.go global search palette, namespace picker
27-
nspicker.go namespace picker logic
28+
ctxpicker.go context chooser, in the main panel
29+
settings.go/_view.go the settings dialog (CLI name, AI, update check)
30+
logview.go the log viewer
31+
shell.go the in-panel interactive shell (exec)
2832
loading.go spinner / indeterminate progress
2933
```
3034

@@ -112,9 +116,9 @@ does the work off-thread and posts a message back (`internal/ui/msgs.go`):
112116

113117
| Message | Produced by |
114118
|----------------------------------|----------------------------------------------|
115-
| `textResultMsg` | describe / YAML / logs snapshot / top / AI |
119+
| `textResultMsg` | describe / YAML / logs snapshot / top / AI / a shell command |
116120
| `actionResultMsg` | delete, restart, scale, cordon, drain, apply |
117-
| `ctxSwitchMsg` | `/context` — rebuilds the whole client |
121+
| `ctxSwitchMsg` | `:ctx` — rebuilds the whole client |
118122
| `logStartMsg` / `logLineMsg` | `LogsFollow` streaming |
119123
| `editFetchedMsg` / `editExitMsg` | the `$EDITOR` round trip |
120124
| `portForwardMsg` | port-forward start |
@@ -127,9 +131,9 @@ chain synchronously without a real event loop.
127131

128132
Every clickable element is a named zone: `res:<i>`, `row:<i>`, `act:<id>`,
129133
`zoom`, `close`, `theme`, `nsfield`, `prompt`, `aimode`, `tablesearch`,
130-
`sug:<i>`, `pal:<i>`, `nsp:<i>`, `thm:<i>`, `ob:<i>`, `cf:ok`/`cf:no`,
131-
`cfg:*`. `handleMouse` checks overlay zones first (confirm → config → theme
132-
onboarding → palette → namespace → suggestions), then chrome, then lists.
134+
`sug:<i>`, `pal:<i>`, `grp:<i>`, `thm:<i>`, `cf:ok`/`cf:no`,
135+
`set:<i>`. `handleMouse` checks overlay zones first (confirm → settings
136+
theme → palette → suggestions), then chrome, then lists.
133137

134138
Two fallbacks make panes feel solid rather than only their contents:
135139
- the wheel scrolls **and focuses** whichever pane the pointer is over
@@ -145,7 +149,7 @@ selection — the only way to copy text out of a mouse-capturing TUI.
145149
1. `ctrl+c` always quits
146150
2. confirm modal (enter/y confirm, esc/n cancel)
147151
3. search palette / namespace picker
148-
4. first-run onboarding, theme picker
152+
4. theme picker
149153
5. AI settings modal (incl. inline edit sub-state)
150154
6. prompt focused → suggestions navigation, then textinput
151155
7. resource list focused → type-to-filter

docs/backends.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ a `domain.Source` that serves what kubeconfig already knows — the kind list,
3131
the context list — and answers `errConnecting` to everything else. The main
3232
panel shows a spinner meanwhile, so an API server behind a downed VPN, or an
3333
exec credential plugin that stalls, leaves a working UI on screen instead of
34-
a blank terminal. Picking a context in `/context` during that wait retargets
34+
a blank terminal. Picking a context in `:ctx` during that wait retargets
3535
the connection rather than switching from a backend that isn't there yet;
3636
each attempt carries a generation, so a slow first one landing later is
3737
dropped instead of overwriting the newer one.
@@ -43,7 +43,7 @@ dropped instead of overwriting the newer one.
4343
| `client.go` | kubeconfig loading, clientset/dynamic/discovery/metrics |
4444
| `store.go` | the Store, lazy informer registry, metrics polling |
4545
| `listers.go` | lazy per-kind lister accessors |
46-
| `kinds.go` | the 16 kinds, their columns and allowed actions |
46+
| `kinds.go` | the 30 kinds, their columns and allowed actions |
4747
| `rows.go` | object → row formatting, sorting, namespace filtering |
4848
| `counts.go` | cheap background counts for unopened kinds |
4949
| `describe.go` | kubectl's own describers, generic fallback for CRs |
@@ -69,6 +69,15 @@ Table data comes from client-go informers, which keep a local cache warm off
6969
a watch. Informers are started **lazily, per kind** — see
7070
[performance.md](performance.md).
7171

72+
Adding a kind means touching five places, all of them switch-shaped so a
73+
missing one fails loudly: `kinds.go` (entry, columns, allowed actions),
74+
`store.go` (informer registration + its GroupVersionResource, which is what
75+
YAML/edit/delete/badge counts all resolve through), `listers.go` (the lazy
76+
lister accessor), `rows.go` (object → row, plus the `RowCount` case), and
77+
`describe.go` (the GroupKind kubectl's describer is registered under). Then
78+
mirror it in `internal/mock``TestBackendsServeTheSameKinds` fails if you
79+
don't — and give it aliases in `internal/ui/commands.go`.
80+
7281
`Describe` uses kubectl's own describers (`kubectl/pkg/describe`) so output
7382
matches `kubectl describe`, with a generic unstructured describer for CRDs
7483
and custom resources. `YAML` goes through the dynamic client and strips
@@ -95,8 +104,9 @@ and custom resources. `YAML` goes through the dynamic client and strips
95104
backwards cursor, so "older" means re-reading with a larger tail.
96105
`LogsFollow` then streams new lines over a channel; the UI tags each with a
97106
generation number so a stale stream can't append into a view you've left.
98-
Workloads resolve to one of their pods via the workload's label selector,
99-
preferring a running one. Kinds with no logs return `domain.ErrNoLogs`,
107+
Workloads (Deployment, StatefulSet, DaemonSet, Job, ReplicaSet) resolve to
108+
one of their pods via the workload's label selector, preferring a running
109+
one. Kinds with no logs return `domain.ErrNoLogs`,
100110
which the UI treats as "show describe instead", not as a failure.
101111
- **Exec**`ShellSession` opens an interactive exec and hands back a
102112
writer for keystrokes plus a channel of raw output bytes, so the UI can
@@ -116,7 +126,8 @@ reads its cache.
116126

117127
## Offline demo — `internal/mock`
118128

119-
Static, in-memory fake cluster: 16 kinds, three nodes (one NotReady), and
129+
Static, in-memory fake cluster: the same 30 kinds, three nodes (one
130+
NotReady), and
120131
rows seeded with deliberate trouble — `billing-worker` in CrashLoopBackOff
121132
×17, a `payment-api` pod Pending on insufficient CPU, a Terminating pod — so
122133
status colors and events have something real to point at.
@@ -127,7 +138,7 @@ It backs:
127138
- k10s itself when no cluster is reachable.
128139

129140
A resource's base `Rows` are implicitly namespace `default`; `Extra` holds
130-
rows tagged with another namespace, which is what makes `/ns` switching show
141+
rows tagged with another namespace, which is what makes `:ns` switching show
131142
genuinely different data. `argocd` / `cert-manager` only carry Custom
132143
Resource instances.
133144

0 commit comments

Comments
 (0)