From 1ec5b01b3e0e93c95605cefa870bcacc3f493630 Mon Sep 17 00:00:00 2001 From: Keith Solomon Date: Sat, 27 Jun 2026 13:20:29 -0500 Subject: [PATCH] docs: specify repo name fallback --- ...ject-tracking-repo-name-fallback-design.md | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 docs/superpowers/specs/2026-06-27-claude-project-tracking-repo-name-fallback-design.md diff --git a/docs/superpowers/specs/2026-06-27-claude-project-tracking-repo-name-fallback-design.md b/docs/superpowers/specs/2026-06-27-claude-project-tracking-repo-name-fallback-design.md new file mode 100644 index 0000000..d6c3447 --- /dev/null +++ b/docs/superpowers/specs/2026-06-27-claude-project-tracking-repo-name-fallback-design.md @@ -0,0 +1,29 @@ +# Claude Project Tracking Repository Name Fallback + +## Goal + +Ensure the `claude` shell wrapper always adds a normalized `project.name` to `OTEL_RESOURCE_ATTRIBUTES`, including when the current directory is not inside a Git repository. + +## Design + +The wrapper will determine a raw repository name before normalizing it: + +- Inside a Git work tree, use the existing Git-derived top-level directory name. +- Outside a Git work tree, use the basename of the current working directory. + +Both paths will share one normalization step. It will lowercase the name, replace spaces with underscores, preserve letters, digits, underscores, and hyphens, and remove other characters. For example, `My Cool-Project!` becomes `my_cool-project`. + +The wrapper will then prepend `project.name=` to an existing `OTEL_RESOURCE_ATTRIBUTES` value or create the variable when it is empty. Finally, it will invoke the real Claude Code binary with all original arguments. + +## Error Handling + +Git command failures outside a work tree are expected and will select the current-directory fallback. Existing behavior for invoking `command claude` remains unchanged. + +## Verification + +Automated shell checks will source the wrapper with a stubbed `claude` executable and verify: + +- A non-Git directory with spaces and punctuation produces the expected normalized project name. +- An existing OTel attribute string is retained after the project name is prepended. +- The wrapper forwards all arguments to the real command. +- Existing Git-repository naming behavior remains intact.