# dhetchaiyakrith24/smogz-rules architecture

> Architecture diagram of the GitHub repository dhetchaiyakrith24/smogz-rules, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dhetchaiyakrith24/smogz-rules
- Repository: https://github.com/dhetchaiyakrith24/smogz-rules

## Overview

smogz-rules maintains one canonical set of shared rules and distributes copies to configured project repositories. The workflow is: an owner authorizes a change, maintainers update the canonical rules through a PR, the guard checks them, and after merge the sync automation opens copy PRs for target repositories. Separate automation checks the sync token and reports expiry risk. Relationships below follow the README; source excerpts were unavailable, so implementation details beyond documented behavior are omitted.

Main entry points: [`scripts/sync.sh`](https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/scripts/sync.sh) (Copy sync), [`scripts/guard.sh`](https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/scripts/guard.sh) (Guard check), [`.github/workflows/token-check.yml`](https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/.github/workflows/token-check.yml) (Token check), [`.github/workflows/sync.yml`](https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/.github/workflows/sync.yml) (Sync workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_canonical["Canonical rules"]
  node_claude["Canonical rules<br/>[CLAUDE.md]"]
end

subgraph group_checks["Validation and tokens"]
  node_project_words["Project-only words"]
  node_guard_script["Guard check<br/>[guard.sh]"]
  node_guard_workflow["Guard workflow<br/>[guard.yml]"]
  node_token_workflow["Token check<br/>[token-check.yml]"]
end

subgraph group_distribution["Copy distribution"]
  node_targets["Target repositories<br/>[targets.txt]"]
  node_sync_script["Copy sync<br/>[sync.sh]"]
  node_sync_workflow["Sync workflow<br/>[sync.yml]"]
end

node_owner(("Rule owner"))
node_maintainers(("Repository maintainers"))
node_actions["GitHub Actions"]
node_sync_token[("Sync token")]
node_target_repos[("Destination repositories")]
node_copy_prs["Copy pull requests"]
node_issues["Failure issues"]

node_owner -->|"authorizes changes"| node_maintainers
node_maintainers -->|"edits via PR"| node_claude
node_actions -->|"runs"| node_guard_workflow
node_guard_workflow -->|"invokes"| node_guard_script
node_guard_script -->|"checks"| node_claude
node_guard_script -->|"reads"| node_project_words
node_actions -->|"runs"| node_sync_workflow
node_sync_workflow -->|"invokes"| node_sync_script
node_sync_script -->|"copies"| node_claude
node_sync_script -->|"reads"| node_targets
node_sync_script -->|"uses"| node_sync_token
node_sync_script -->|"updates"| node_target_repos
node_sync_script -->|"opens"| node_copy_prs
node_actions -->|"runs weekly"| node_token_workflow
node_token_workflow -->|"checks validity"| node_sync_token
node_token_workflow -->|"reports expiry"| node_issues
node_sync_workflow -->|"reports failure"| node_issues

click node_claude "https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/CLAUDE.md"
click node_targets "https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/targets.txt"
click node_project_words "https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/guard/project-only-words.txt"
click node_guard_script "https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/scripts/guard.sh"
click node_guard_workflow "https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/.github/workflows/guard.yml"
click node_sync_script "https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/scripts/sync.sh"
click node_sync_workflow "https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/.github/workflows/sync.yml"
click node_token_workflow "https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/.github/workflows/token-check.yml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_claude toneBlue
class node_project_words,node_guard_script,node_guard_workflow,node_token_workflow,node_sync_token,node_target_repos toneAmber
class node_targets,node_sync_script,node_sync_workflow,node_copy_prs toneMint
class node_owner,node_maintainers,node_actions,node_issues toneIndigo
```

## Components

### Canonical rules

- [Canonical rules](https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/CLAUDE.md): `CLAUDE.md`

### Validation and tokens

- [Project-only words](https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/guard/project-only-words.txt): `guard/project-only-words.txt`
- [Guard check](https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/scripts/guard.sh): `scripts/guard.sh`
- [Guard workflow](https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/.github/workflows/guard.yml): `.github/workflows/guard.yml`
- [Token check](https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/.github/workflows/token-check.yml): `.github/workflows/token-check.yml`

### Copy distribution

- [Target repositories](https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/targets.txt): `targets.txt`
- [Copy sync](https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/scripts/sync.sh): `scripts/sync.sh`
- [Sync workflow](https://github.com/dhetchaiyakrith24/smogz-rules/blob/main/.github/workflows/sync.yml): `.github/workflows/sync.yml`

### Other components

- **Rule owner**
- **Repository maintainers**
- **GitHub Actions**
- **Sync token**
- **Destination repositories**
- **Copy pull requests**
- **Failure issues**

## Connections

- Rule owner → Repository maintainers: authorizes changes
- Repository maintainers → Canonical rules: edits via PR
- GitHub Actions → Guard workflow: runs
- Guard workflow → Guard check: invokes
- Guard check → Canonical rules: checks
- Guard check → Project-only words: reads
- GitHub Actions → Sync workflow: runs
- Sync workflow → Copy sync: invokes
- Copy sync → Canonical rules: copies
- Copy sync → Target repositories: reads
- Copy sync → Sync token: uses
- Copy sync → Destination repositories: updates
- Copy sync → Copy pull requests: opens
- GitHub Actions → Token check: runs weekly
- Token check → Sync token: checks validity
- Token check → Failure issues: reports expiry
- Sync workflow → Failure issues: reports failure
