# 0xsojalsec/pipet architecture

> Architecture diagram of the GitHub repository 0xsojalsec/pipet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/0xsojalsec/pipet
- Repository: https://github.com/0xsojalsec/pipet

## Overview

Pipet is a command-line scraper that reads a `.pipet` specification, fetches resources with curl or Playwright, extracts nested query results, and renders them as text, JSON, or a template. It also supports pagination, shell-pipe processing, and interval-based change notifications. The graph reflects the sampled call sites and documented capabilities; some README-described behavior, particularly Playwright installation details and monitoring semantics, is represented at the CLI level rather than as a separately inspected subsystem.

Main entry points: [`cmd/pipet/main.go`](https://github.com/0xsojalsec/pipet/blob/main/cmd/pipet/main.go) (CLI entry), [`common/common.go`](https://github.com/0xsojalsec/pipet/blob/main/common/common.go) (App data model), [`internal/app/app.go`](https://github.com/0xsojalsec/pipet/blob/main/internal/app/app.go) (Block executor), [`parsers/utils.go`](https://github.com/0xsojalsec/pipet/blob/main/parsers/utils.go) (Curl execution)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and orchestration"]
  node_entry["CLI entry<br/>[main.go]"]
  node_spec["Spec parser<br/>[app.go]"]
  node_executor["Block executor<br/>[app.go]"]
  node_pagination["Pagination<br/>[app.go]"]
end

subgraph group_scrape["Scraping and extraction"]
  node_curl["Curl execution<br/>[utils.go]"]
  node_playwright["Playwright execution<br/>[playwright.go]"]
  node_html["HTML queries<br/>[html.go]"]
  node_jsonparse["JSON queries<br/>[json.go]"]
  node_pipe["Shell pipe processing<br/>[utils.go]"]
end

subgraph group_shared["Shared data and utilities"]
  node_model["App data model<br/>[common.go]"]
  node_queryutils["Query utilities<br/>[utils.go]"]
  node_flatten["Result formatting helpers<br/>[utils.go]"]
end

subgraph group_render["Result rendering"]
  node_text["Text output<br/>[text.go]"]
  node_jsonout["JSON output<br/>[json.go]"]
  node_template["Template output<br/>[template.go]"]
end

node_user(("CLI user"))
node_curlservice["curl command"]
node_browser["Headless browser"]
node_shell["Shell commands"]
node_templatefile["Template file"]
node_stdout(("Terminal output"))

node_user -->|"runs"| node_entry
node_entry -->|"parses spec"| node_spec
node_entry -->|"executes blocks"| node_executor
node_entry -->|"configures"| node_model
node_spec -->|"fills blocks"| node_model
node_executor -->|"reads blocks"| node_model
node_executor -->|"dispatches curl"| node_curl
node_executor -->|"dispatches browser"| node_playwright
node_executor -->|"resolves next page"| node_pagination
node_pagination -->|"updates command"| node_model
node_curl -->|"runs command"| node_curlservice
node_curl -->|"parses HTML"| node_html
node_curl -->|"parses JSON"| node_jsonparse
node_html -->|"uses indentation"| node_queryutils
node_jsonparse -->|"uses indentation"| node_queryutils
node_html -->|"runs pipe"| node_pipe
node_jsonparse -->|"runs pipe"| node_pipe
node_playwright -->|"evaluates queries"| node_browser
node_playwright -->|"runs pipe"| node_pipe
node_pipe -->|"executes command"| node_shell
node_entry -->|"selects text"| node_text
node_entry -->|"selects JSON"| node_jsonout
node_entry -->|"selects template"| node_template
node_entry -->|"detects template"| node_flatten
node_text -->|"flattens results"| node_flatten
node_text -->|"reads results"| node_model
node_jsonout -->|"serializes results"| node_model
node_template -->|"renders results"| node_model
node_template -->|"reads template"| node_templatefile
node_entry -->|"prints result"| node_stdout
node_entry -->|"runs change command"| node_shell

click node_entry "https://github.com/0xsojalsec/pipet/blob/main/cmd/pipet/main.go"
click node_spec "https://github.com/0xsojalsec/pipet/blob/main/internal/app/app.go"
click node_executor "https://github.com/0xsojalsec/pipet/blob/main/internal/app/app.go"
click node_pagination "https://github.com/0xsojalsec/pipet/blob/main/internal/app/app.go"
click node_model "https://github.com/0xsojalsec/pipet/blob/main/common/common.go"
click node_curl "https://github.com/0xsojalsec/pipet/blob/main/parsers/utils.go"
click node_playwright "https://github.com/0xsojalsec/pipet/blob/main/parsers/playwright.go"
click node_html "https://github.com/0xsojalsec/pipet/blob/main/parsers/html.go"
click node_jsonparse "https://github.com/0xsojalsec/pipet/blob/main/parsers/json.go"
click node_pipe "https://github.com/0xsojalsec/pipet/blob/main/parsers/utils.go"
click node_queryutils "https://github.com/0xsojalsec/pipet/blob/main/parsers/utils.go"
click node_flatten "https://github.com/0xsojalsec/pipet/blob/main/utils/utils.go"
click node_text "https://github.com/0xsojalsec/pipet/blob/main/outputs/text.go"
click node_jsonout "https://github.com/0xsojalsec/pipet/blob/main/outputs/json.go"
click node_template "https://github.com/0xsojalsec/pipet/blob/main/outputs/template.go"

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_entry,node_spec,node_executor,node_pagination,node_user,node_browser toneBlue
class node_curl,node_playwright,node_html,node_jsonparse,node_pipe toneAmber
class node_model,node_queryutils,node_flatten toneMint
class node_text,node_jsonout,node_template toneRose
class node_curlservice,node_shell,node_templatefile,node_stdout toneIndigo
```

## Components

### CLI and orchestration

- [CLI entry](https://github.com/0xsojalsec/pipet/blob/main/cmd/pipet/main.go): `cmd/pipet/main.go`
- [Spec parser](https://github.com/0xsojalsec/pipet/blob/main/internal/app/app.go): `internal/app/app.go`
- [Block executor](https://github.com/0xsojalsec/pipet/blob/main/internal/app/app.go): `internal/app/app.go`
- [Pagination](https://github.com/0xsojalsec/pipet/blob/main/internal/app/app.go): `internal/app/app.go`

### Scraping and extraction

- [Curl execution](https://github.com/0xsojalsec/pipet/blob/main/parsers/utils.go): `parsers/utils.go`
- [Playwright execution](https://github.com/0xsojalsec/pipet/blob/main/parsers/playwright.go): `parsers/playwright.go`
- [HTML queries](https://github.com/0xsojalsec/pipet/blob/main/parsers/html.go): `parsers/html.go`
- [JSON queries](https://github.com/0xsojalsec/pipet/blob/main/parsers/json.go): `parsers/json.go`
- [Shell pipe processing](https://github.com/0xsojalsec/pipet/blob/main/parsers/utils.go): `parsers/utils.go`

### Shared data and utilities

- [App data model](https://github.com/0xsojalsec/pipet/blob/main/common/common.go): `common/common.go`
- [Query utilities](https://github.com/0xsojalsec/pipet/blob/main/parsers/utils.go): `parsers/utils.go`
- [Result formatting helpers](https://github.com/0xsojalsec/pipet/blob/main/utils/utils.go): `utils/utils.go`

### Result rendering

- [Text output](https://github.com/0xsojalsec/pipet/blob/main/outputs/text.go): `outputs/text.go`
- [JSON output](https://github.com/0xsojalsec/pipet/blob/main/outputs/json.go): `outputs/json.go`
- [Template output](https://github.com/0xsojalsec/pipet/blob/main/outputs/template.go): `outputs/template.go`

### Other components

- **CLI user**
- **curl command**
- **Headless browser**
- **Shell commands**
- **Template file**
- **Terminal output**

## Connections

- CLI user → CLI entry: runs (evidence: `README.md`)
- CLI entry → Spec parser: parses spec (evidence: `cmd/pipet/main.go`)
- CLI entry → Block executor: executes blocks (evidence: `cmd/pipet/main.go`)
- CLI entry → App data model: configures (evidence: `cmd/pipet/main.go`)
- Spec parser → App data model: fills blocks (evidence: `internal/app/app.go`)
- Block executor → App data model: reads blocks (evidence: `internal/app/app.go`)
- Block executor → Curl execution: dispatches curl (evidence: `internal/app/app.go`)
- Block executor → Playwright execution: dispatches browser (evidence: `internal/app/app.go`)
- Block executor → Pagination: resolves next page (evidence: `internal/app/app.go`)
- Pagination → App data model: updates command (evidence: `internal/app/app.go`)
- Curl execution → curl command: runs command (evidence: `parsers/utils.go`)
- Curl execution → HTML queries: parses HTML (evidence: `parsers/utils.go`)
- Curl execution → JSON queries: parses JSON (evidence: `parsers/utils.go`)
- HTML queries → Query utilities: uses indentation (evidence: `parsers/html.go`)
- JSON queries → Query utilities: uses indentation (evidence: `parsers/json.go`)
- HTML queries → Shell pipe processing: runs pipe (evidence: `parsers/html.go`)
- JSON queries → Shell pipe processing: runs pipe (evidence: `parsers/json.go`)
- Playwright execution → Headless browser: evaluates queries (evidence: `parsers/playwright.go`)
- Playwright execution → Shell pipe processing: runs pipe (evidence: `parsers/playwright.go`)
- Shell pipe processing → Shell commands: executes command (evidence: `parsers/utils.go`)
- CLI entry → Text output: selects text (evidence: `cmd/pipet/main.go`)
- CLI entry → JSON output: selects JSON (evidence: `cmd/pipet/main.go`)
- CLI entry → Template output: selects template (evidence: `cmd/pipet/main.go`)
- CLI entry → Result formatting helpers: detects template (evidence: `cmd/pipet/main.go`)
- Text output → Result formatting helpers: flattens results (evidence: `outputs/text.go`)
- Text output → App data model: reads results (evidence: `outputs/text.go`)
- JSON output → App data model: serializes results (evidence: `outputs/json.go`)
- Template output → App data model: renders results (evidence: `outputs/template.go`)
- Template output → Template file: reads template (evidence: `outputs/template.go`)
- CLI entry → Terminal output: prints result (evidence: `cmd/pipet/main.go`)
- CLI entry → Shell commands: runs change command (evidence: `cmd/pipet/main.go`)
