aks-desktop
AGENTS.md114 starsChanged 2 months agoApache-2.0View on GitHub
Navigation guide for AI coding agents. For Headlamp plugin API examples see plugins/aks-desktop/AGENTS.md. Headlamp source is generated under packages/headlamp-source/source/ and installed under node_modules/@headlamp-k8s/headlamp-source/. Do not edit generated copies as the source of a fix. See MAINTENANCE.md for source updates and the patch workflow. - headlamp-source is independent of AKS Desktop and must support other consumers. AKS code may depend on the package; the package must not import AKS build code, plugins, or product assets. - Product names, versions, icons, command…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- plugins/aks-desktop/AGENTS.mdAGENTS.md
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
14 rules. About 0 are common, 4 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 31
Use temporary, synthetic consumer projects.
- Very specific: line 37
Run npm --prefix packages/headlamp-source run test:helpers for reusable helpers and contracts.
- Distinctive: line 40
If a package test needs an AKS fixture from this checkout, move that assertion to the consumer suite instead of making the package depend …
- Distinctive: line 66
Never import from another feature component's internals.
- Very specific: line 67
No barrel files (enforced by ESLint no-barrel-files rule).
- Very specific: line 75
Create <StepName>Step.tsx in the wizard's components/ directory.
- Distinctive: line 76
Add the step to the wizard's step list in the parent wizard component.
- Very specific: line 77
Add tests (co-located .test.tsx) and optionally a .stories.tsx.
- Very specific: line 83
Add a typed wrapper in the appropriate src/utils/azure/<domain>.ts module, or create a new domain module if none fits.
- Very specific: line 84
Call runAzCommand<T>(args, debugLabel, errorContext, parseOutput) and pass a parseOutput callback (for JSON output: stdout => …
- Distinctive: line 85
Keep each azure util module single-responsibility.
- Very specific: line 91
Call registerRoute() with the path, component, and sidebar entry name.
- Very specific: line 92
Call registerSidebarEntry() for navigation.
- Very specific: line 97
Use registerProjectDetailsTab() or registerProjectOverviewSection() in src/index.tsx.
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
Navigation guide for AI coding agents. For Headlamp plugin API examples see plugins/aks-desktop/AGENTS.md.
Architecture Layers
| Layer | Path | Purpose | When to change |
| Plugin | plugins/aks-desktop/ | AKS-specific UI, Azure integration, Kubernetes operations | Most changes go here |
| Build | build/ | Plugin setup, external tool bundling (Azure CLI, Python), post-build verification | Packaging, bundled tool versions, installer behavior |
| Source package | packages/headlamp-source/ | Reusable Headlamp source assembly and build entry points | Consumer-independent behavior |
| Headlamp patches | patches/ | Changes to the pinned Electron shell, backend, and frontend | Only when the product manifest or plugin APIs cannot express the behavior |
Headlamp source is generated under packages/headlamp-source/source/ and installed
under node_modules/@headlamp-k8s/headlamp-source/. Do not edit generated copies as
the source of a fix. See MAINTENANCE.md for source updates and
the patch workflow.
Source-Package Boundary
headlamp-sourceis independent of AKS Desktop and must support other consumers. AKS code may depend on the package; the package must not import AKS build code, plugins, or product assets.- Product names, versions, icons, command grants, shipped plugins, external-tool selections, and downstream patches belong to the consumer. Pass them through the documented configuration rather than adding AKS-specific branches to the package.
- AKS runtime tool selection and digest checks belong in
build/aks-tool-environment.cjs. Headlamp's0071patch provides only the app-ownedcommandEnvironmentcallback; do not move AKS'sexternal-toolsinterpretation into Headlamp or its documentation. - Package helper tests belong beside the helpers in
packages/headlamp-source/src/lib/. Use temporary, synthetic consumer projects. Package contract tests inpackages/headlamp-source/test/may read the package's own metadata, but must not discover this repository's root manifest, lockfile, plugins, icons, or installed app. - Tests that need real AKS configuration or its installed, patched Headlamp belong
in the existing
test/integration/directory.headlamp-package.test.tsthere owns the product version, branding, policy, installation, and patch contracts. - Run
npm --prefix packages/headlamp-source run test:helpersfor reusable helpers and contracts. From the repository root,npm run test:headlamp-packageruns package contracts plus AKS integration tests and remains the CI entry point. - If a package test needs an AKS fixture from this checkout, move that assertion to the consumer suite instead of making the package depend on the checkout layout.
Decision Tree -- "Where does my change go?"
| Change type | Location |
| Azure CLI operations | plugins/aks-desktop/src/utils/azure/<domain-module>.ts (e.g., az-acr.ts, az-identity.ts, aks.ts) |
| Kubernetes operations | plugins/aks-desktop/src/utils/kubernetes/ |
| GitHub integration | plugins/aks-desktop/src/utils/github/ |
| New UI feature | plugins/aks-desktop/src/components/<FeatureName>/ |
| Shared hooks | plugins/aks-desktop/src/hooks/ |
| Shared types | plugins/aks-desktop/src/types/ |
| Component-local types | Co-located in the component directory (e.g., plugins/aks-desktop/src/components/DeployWizard/components/types.ts) |
| Plugin registration | plugins/aks-desktop/src/index.tsx |
| Build / packaging | build/ |
| Reusable source assembly | packages/headlamp-source/ |
| AKS source-package integration tests | test/integration/ |
| Headlamp core | patches/ (see MAINTENANCE.md) |
Module Boundary Rules
In the sections below,
src/is shorthand forplugins/aks-desktop/src/.
- Feature components (
src/components/<Feature>/) own their sub-components, hooks, utils, types, and tests. - Cross-feature shared code lives in
src/utils/,src/hooks/, orsrc/types/. - Never import from another feature component's internals. If two features need the same logic, extract it to a shared location.
- No barrel files (enforced by ESLint
no-barrel-filesrule).
Common Patterns
Adding a wizard step
Wizard steps live in src/components/<Wizard>/components/. Each step is a standalone component (e.g., BasicsStep.tsx, NetworkingStep.tsx). See DeployWizard for the canonical example:
- Create
<StepName>Step.tsxin the wizard'scomponents/directory. - Add the step to the wizard's step list in the parent wizard component.
- Add tests (co-located
.test.tsx) and optionally a.stories.tsx.
Azure CLI command (runAzCommand)
New Azure CLI calls should go through runAzCommand<T>() in src/utils/azure/az-cli-core.ts, which provides structured error handling and typed responses. Domain-specific modules (e.g., az-acr.ts, az-identity.ts, aks.ts) wrap this function with typed helpers. Some older modules still call runCommandAsync('az', ...) directly. To add a new Azure operation:
- Add a typed wrapper in the appropriate
src/utils/azure/<domain>.tsmodule, or create a new domain module if none fits. - Call
runAzCommand<T>(args, debugLabel, errorContext, parseOutput)and pass aparseOutputcallback (for JSON output:stdout => JSON.parse(stdout)) -- it handles process execution, error wrapping, and returns{ success, data, error }. - Keep each azure util module single-responsibility.
Route and sidebar entry
Register routes and sidebar entries in src/index.tsx:
- Call
registerRoute()with the path, component, and sidebar entry name. - Call
registerSidebarEntry()for navigation. - Gate Azure-specific routes behind
Headlamp.isRunningAsApp().
Project tab or overview section
Use registerProjectDetailsTab() or registerProjectOverviewSection() in src/index.tsx. Gate behind isAksProject() to show only for AKS-managed projects.
Testing Conventions
- Co-located tests:
<Component>.test.tsxalongside the component file. - Accessibility tests:
<Component>.guidepup.test.tsxfiles use guidepup for screen-reader-level a11y testing. - Fixtures:
__fixtures__/directories within feature components for shared test data. - Integration tests:
src/utils/test/for cross-module tests (Azure CLI, cluster settings, namespace utils). - Stories:
.stories.tsxfiles for Storybook visual testing, co-located with components.
File Size Guidance
- Aim for under 400 lines per file. If a file exceeds this, look for opportunities to extract sub-components, hooks, or utility functions.
- Azure util modules (
src/utils/azure/) should each cover a single domain (ACR, identity, federation, etc.). Split rather than grow a catch-all module.
Cross-References
- Headlamp plugin API examples and patterns:
plugins/aks-desktop/AGENTS.md - Source-package maintenance and patch workflow:
MAINTENANCE.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

