Documentation Design — sap-devs-cli
Date: 2026-04-14
Status: Approved
Scope: Three audience-specific documentation guides
Problem
The project has no user-facing documentation. The README is a single title line. Without docs, functional testing cannot begin, and new contributors, content maintainers, and end users have no reference material.
Goal
Create three standalone Markdown guides, one per audience, covering all aspects of the project needed for functional testing and ongoing use.
Approach
Approach A — Three standalone guides (selected)
| File | Audience |
|---|---|
docs/developer/developer-guide.md | Contributors building and releasing the CLI |
docs/content/content-guide.md | Content maintainers adding/translating packs |
docs/user/user-guide.md | End users installing and using the tool |
Each file is fully self-contained for its audience. The project README will be updated to serve as an index linking to each guide.
Guide 1 — Developer Guide (docs/developer/developer-guide.md)
Sections
Prerequisites
Go 1.26+, git,libx11-devon Linux (required bygolang.design/x/clipboard).Clone & build
Module pathgithub.com/SAP-samples/sap-devs-cli. Build command with ldflags version injection fromgit describe. Output binary namedsap-devs.Local development
SAP_DEVS_DEV=1env var causes content to load from./content/instead of the user cache. Usego run .with this set for rapid iteration without rebuilding.Linting & static analysis
go build ./...+go vet ./.... Explanation of whygo testis blocked on Windows: Windows Defender quarantines test binaries executed from~/.configpaths.Running tests
go test ./...for all packages; single-package form for focused runs. CI runs on a self-hostedLinux X64runner (runs-on: [self-hosted, Linux, X64]) and is the authoritative test runner.Project layout
Brief directory map:cmd/(cobra commands),internal/(adapter, config, content, i18n, sync, update, xdg packages),content/(packs, adapters, profiles),.github/(CI + release workflows),.goreleaser.yml.Architecture overview
Full prose description of:- Content Layer System — 4 layers (official cache → company cache → user data → project), merged by ID with later layers winning.
ContentLoaderininternal/content/loader.go. Each pack directory structure. - Adapter System —
content/adapters/YAML files. Three types:file-inject(writes fenced section into config file),clipboard-export(copies to clipboard),mcp-wire(registers MCP servers).Engineininternal/adapter/engine.gofilters by tool and scope. - Profiles —
content/profiles/YAML files tag packs to developer personas.ApplyWeights()reorders packs. Active profile stored in~/.config/sap-devs/profile.yaml. - Sync — fetches official repo as
.zip, extracts to cache. Per-category TTLs in~/.cache/sap-devs/sync-state.json.sync.Engineininternal/sync/engine.go. - i18n —
internal/i18npackage. Language resolved from config →LANG/LC_ALLenv →en. CLI strings ininternal/i18n/catalogs/<lang>.json. Pack content localised viacontext.<lang>.md,tips.<lang>.md,pack.yamllocales block. - Update Check — background goroutine on every command invocation (except
updateand dev builds). Checks GitHub at most once per 168h. Prints to stderr after command completes. - Platform Paths —
internal/xdgresolves config/cache/data directories per OS.
- Content Layer System — 4 layers (official cache → company cache → user data → project), merged by ID with later layers winning.
Adding a command
Cobra command pattern, file location incmd/, i18n key naming convention (cmd.subcommand.short,cmd.subcommand.long, etc.), wiring into root or parent command incmd/root.go.Release workflow (full walkthrough)
- Pre-release checklist: CI green on
main, all tests passing, changelog entries present. - Tag and push:
git tag v1.2.3 && git push origin v1.2.3. - GitHub Actions
release.ymltriggers onv*tags, runs GoReleaser onubuntu-latest. - GoReleaser reads
.goreleaser.yml:- Builds: Linux amd64/arm64 (
.tar.gz), macOS amd64/arm64 (.tar.gz), Windows amd64 (.zip). Windows arm64 excluded. - Version injected via
-ldflags "-X github.com/SAP-samples/sap-devs-cli/cmd.Version={{ .Version }}"(full symbol path required). - Archive naming:
sap-devs_<version>_<os>_<arch>.<ext>. checksums.txt(SHA256) included in release assets.
- Builds: Linux amd64/arm64 (
- Verify artifacts appear on the GitHub Releases page.
- Post-release: update any documentation version references if needed.
- Pre-release checklist: CI green on
Worktrees
Feature branch worktrees stored in.worktrees/in project root. Not~/.config— Windows Defender blocks test binary execution from that path.
Guide 2 — Content Guide (docs/content/content-guide.md)
Sections
Overview
What content is and how the 4-layer merge works. Where each layer lives on disk per platform (official cache, company cache, user data dir, project.sap-devs/).Pack structure
Directory:content/packs/<pack-id>/. Full schema for each file:pack.yaml—id(unique slug),name,description,tags(list),profiles(list of profile IDs that include this pack),weight(integer default priority; profiles can override per-pack in theirpackslist),localesblock mapping language tag to translatedname/description.context.md— Free-form Markdown injected as AI context into tools. No special syntax. May be long-form reference material.context.<lang>.md— Localised version ofcontext.mdfor language<lang>(e.g.context.de.md). Falls back tocontext.mdif absent.tips.md— H2-delimited tips. Each tip starts with## <Title>, followed by optionalTags: tag1,tag2line, then tip body.tips.<lang>.md— Localised version oftips.md.tools.yaml— List of tool requirement entries. Each entry:id,name,required(semver constraint),detect(command+patternregex),install(per-platform orallkey),docs(URL).resources.yaml— List of resource entries. Each entry:id(<pack>/<slug>),title,url,type(official-docs,sample,community,tutorial, etc.),tags.mcp.yaml— MCP server definitions (covered in MCP section).
Adapters
File:content/adapters/<tool-id>.yaml. Schema:id,name,type,targetslist (each withscope,path,mode,section),detectlist (command or path checks),mcp_config(path, format, key). Modes:replace-sectionreplaces the named fenced section;appendadds content if not present. Scope:global(user-level config file) orproject(project-level file in CWD).Profiles
File:content/profiles/<profile-id>.yaml. Schema:id,name,description,packslist (each withidandweight),tip_tags.ApplyWeights()reorders packs so higher-weight packs appear first in rendered context.Creating a new pack
Step-by-step:- Create
content/packs/<new-id>/. - Write
pack.yamlwith a uniqueid. - Add
context.md,tips.md,tools.yaml,resources.yaml(all optional; omit files with no content). - Reference the pack in at least one profile's
packslist. - Test:
SAP_DEVS_DEV=1 sap-devs inject --dry-run— verify the new context appears in output.
- Create
Updating existing content
Edit files in the relevant layer. Official content can be overridden at user (~/.local/share/sap-devs/on Linux) or project (.sap-devs/) layer using the sameid— the later layer wins.Translation guide (full)
- Language resolution:
config languagesetting →LANGenv var →LC_ALLenv var → fallbacken. Region/encoding suffixes stripped (de_AT.UTF-8→de). Unknown tags fall back toen. - Pack content files: Add
context.<lang>.mdand/ortips.<lang>.mdalongside the base files. The loader picks the locale-specific file when the active language matches. - Pack metadata: Add a
localesblock inpack.yaml:yamllocales: de: name: Translated name description: Translated description - CLI string catalog: Add
internal/i18n/catalogs/<lang>.json. Keys follow the patterncmd.subcommand.string_name(e.g.inject.done). Values may be plain strings or Gotext/templateexpressions. UseT(lang, key)for plain strings;Tf(lang, key, data)for template strings (e.g."sync.updated": "Updated: {{.Categories}}"). Both requirelangas the first argument — typicallyi18n.ActiveLang. - Adding a new language end-to-end:
- Create
internal/i18n/catalogs/<lang>.jsonwith translated keys (copyen.jsonas starting point; any missing keys fall back to English). - Add
context.<lang>.mdandtips.<lang>.mdto each pack you want to translate. - Add
locales.<lang>blocks topack.yamlfor each pack. - Test:
sap-devs config set language <lang> && sap-devs inject --dry-run.
- Create
- Language resolution:
Guide 3 — User Guide (docs/user/user-guide.md)
Sections
What is sap-devs?
One paragraph: injects up-to-date SAP developer knowledge into AI coding tools (Claude Code, Cursor, Copilot, etc.), wires SAP MCP servers, keeps content current via sync.Installation
- Go to GitHub Releases, find the latest release.
- Download the archive for your platform:
- Windows:
sap-devs_<version>_windows_amd64.zip - macOS Intel:
sap-devs_<version>_darwin_amd64.tar.gz - macOS Apple Silicon:
sap-devs_<version>_darwin_arm64.tar.gz - Linux amd64:
sap-devs_<version>_linux_amd64.tar.gz - Linux arm64:
sap-devs_<version>_linux_arm64.tar.gz
- Windows:
- Verify checksum against
checksums.txt. - Extract and place
sap-devsbinary in PATH:- Windows: extract ZIP, add folder to
PATHvia System Properties or copy to a folder already on PATH. - macOS/Linux:
tar -xzf ... && mv sap-devs /usr/local/bin/(or~/.local/bin/).
- Windows: extract ZIP, add folder to
- Verify:
sap-devs --version.
First-time setup
Runsap-devs init— interactive wizard that sets your developer profile, runs an initial sync, and injects context into detected AI tools.Core workflow
sap-devs sync— pull latest SAP developer content from the official repo.sap-devs inject— push context into all detected AI tools at global (user) scope. Add--projectfor project scope (writes toCLAUDE.md,.cursorrules, etc. in current directory). Add--dry-runto preview without writing.sap-devs profile list/sap-devs profile set <id>— list available personas, set the active one.
Command reference
One subsection per command with synopsis, flags, and a short example:inject—--project,--tool <id>,--dry-runsync—--forceprofile list/profile set <id>/profile showconfig show/config set <key> <value>/config company <url>tip— prints a random tip from active profile packsdoctor—--fix(shows install commands for missing tools)mcp list/mcp status/mcp install <id>resources list/resources search <query>/resources open <id>update— self-update the binaryinit— first-time setup wizard
Configuration
Config file:~/.config/sap-devs/config.yaml(Linux),%APPDATA%/sap-devs/config.yaml(Windows),~/Library/Application Support/sap-devs/config.yaml(macOS). Key settings:language(language tag, e.g.de),company_repo(HTTPS URL to company content repo),sync.disabled(bool). Usesap-devs config showto view,sap-devs config set <key> <value>to change.MCP servers
Brief explanation of what MCP servers are and why they matter.mcp listto browse available SAP MCP servers.mcp statusto see which are already registered in your AI tool configs.mcp install <id>to wire a server into all detected tools. Supported AI tools listed (Claude Code, Cursor, etc.).Keeping up to date
The CLI checks GitHub for a new release in the background on every command (at most once per 7 days). Notification printed to stderr after the command completes. Runsap-devs updateto update immediately.Troubleshooting
Common issues:- "No tips available" / empty context → run
sap-devs sync. - AI tool not detected → ensure the tool is installed and on PATH; check with
sap-devs doctor. - Windows PATH not updating → open a new terminal after modifying PATH.
doctorFAIL/MISSING entries → use--fixflag to see install commands.
- "No tips available" / empty context → run
Platform notes
Config, cache, and data directory paths per OS:- Linux:
~/.config/sap-devs,~/.cache/sap-devs,~/.local/share/sap-devs(XDG env vars honoured) - macOS:
~/Library/Application Support/sap-devs,~/Library/Caches/sap-devs,~/Library/Application Support/sap-devs/data - Windows:
%APPDATA%/sap-devs,%LOCALAPPDATA%/sap-devs/cache,%LOCALAPPDATA%/sap-devs/data
- Linux:
Files to Create
| File | New/Modified |
|---|---|
docs/developer/developer-guide.md | New |
docs/content/content-guide.md | New |
docs/user/user-guide.md | New |
README.md | Modified — replace stub with index linking to all three guides |
Files Not Changed
All source code, CLAUDE.md, and docs/superpowers/ planning docs are out of scope.