Files
claudetools/.claude/commands/inject-standards.md
Howard Enos 2f35163866 harness: read Syncro keys from vault, stop hardcoding the repo root
Two defects found while running /wiki-compile, both from tooling assuming
a path instead of resolving it.

1. Plaintext Syncro API keys. Mike's and Howard's live PSA keys were
   copy-pasted into three command files, a script, and two catalog docs --
   despite both already being vaulted at msp-tools/syncro and
   msp-tools/syncro-howard. Replaced with reads from the SOPS vault via a
   new sourced helper, .claude/scripts/syncro-env.sh. Write paths fail
   closed; read-only paths degrade to skipped enrichment rather than a
   wrong key. Per-user mapping is unchanged, so Syncro attribution is too.

2. Hardcoded repo root. wiki-compile/wiki-lint/inject-standards and
   gen_b64.py hardcoded D:/claudetools; this machine is C:/claudetools.
   syncro.md also read ~/.claude/identity.json before the repo copy -- the
   same bug that made remediation-tool's consent-audit report a fully
   consented tenant as RED. Root now resolves from the script's own
   location, with identity.json claudetools_root as the override.

get-identity.sh had a chicken-and-egg bug: it read ${CLAUDETOOLS_ROOT:-.}
but never set it, so every caller had to already know the root. It now
self-resolves and exports CLAUDETOOLS_ROOT + VAULT_ROOT.

Verified: all three command setup blocks authenticate against live Syncro;
get-identity.sh works from any cwd and honors a pre-set root; gps-rmm
autoenroll resolves its key from the vault. security-review: no findings.

NOTE: both keys remain valid in git history. Rotation in the Syncro portal
is the required follow-up -- this commit does not resolve that exposure.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 07:56:33 -07:00

95 lines
3.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# /inject-standards — Load relevant coding standards into context
Loads one or more standards files from `.claude/standards/` and displays their full content.
## Usage
```
/inject-standards — auto-select based on the current task
/inject-standards powershell/execution-pattern — load a specific standard by path
/inject-standards "syncro billing comment" — load standards relevant to a task description
/inject-standards syncro/comment-dedup syncro/time-entry-protocol — load multiple specific standards
```
## Procedure
Follow these steps exactly when /inject-standards is invoked:
### Step 1 — Parse $ARGUMENTS
- If $ARGUMENTS is empty: proceed to Step 2 (auto-select based on conversation context).
- If $ARGUMENTS contains one or more paths that match known standards slugs (e.g., `powershell/execution-pattern`, `syncro/comment-dedup`): skip Step 2, go directly to Step 3 with those paths.
- If $ARGUMENTS is a task description (plain English, not a path): use it as the query in Step 2.
### Step 2 — Auto-select relevant standards
1. Read `.claude/standards/index.yml`.
2. Review the descriptions for all entries.
3. Select the 25 standards most relevant to either:
- The task description in $ARGUMENTS, or
- The current conversation context (what has the user been working on?).
4. Prefer specificity: `syncro/comment-dedup` is more relevant than `conventions/no-emojis` for a Syncro billing task.
5. Always include `conventions/no-emojis` when writing any output that will go into scripts, logs, or client-facing text.
### Step 3 — Load and display the selected standards
For each selected standard (in order of relevance):
1. Read the file at `.claude/standards/<slug>.md`.
2. Display a header:
```
=== STANDARD: <slug> ===
```
3. Display the full file content (including frontmatter).
4. Add a blank line between standards.
### Step 4 — Report
After displaying all standards, print a one-line summary:
```
[INFO] Loaded N standards: <slug1>, <slug2>, ...
```
If auto-selection was used, briefly explain why each standard was chosen (one phrase per standard).
## Examples
**Specific standards:**
```
/inject-standards powershell/execution-pattern git/commit-style
```
Loads those two files directly and displays them.
**Task description:**
```
/inject-standards "writing a PowerShell script to check Windows service status"
```
Would select: `powershell/execution-pattern`, `conventions/no-emojis`, `conventions/output-markers`
**Syncro billing task:**
```
/inject-standards "billing Syncro ticket for emergency onsite"
```
Would select: `syncro/time-entry-protocol`, `syncro/comment-dedup`, `syncro/html-formatting`
**GuruRMM agent feature:**
```
/inject-standards "adding Linux temperature collection to the agent"
```
Would select: `gururmm/platform-parity`, `gururmm/build-pipeline`, `conventions/no-emojis`
**Empty (auto from context):**
```
/inject-standards
```
Reads the recent conversation, infers the task type, selects 25 most relevant standards.
## Standards index location
`.claude/standards/index.yml`
## Standards files location
`.claude/standards/<folder>/<name>.md`