# Process Scope Statistics

> Delegate to the TianGong CLI to snapshot visible or owner-filtered process rows and compute repeatable coverage statistics for domains, crafts/routes, unit-process rows, and products. Use when you need stable process-scope metrics, especially for `state_code=0/100` maintenance planning.

- Skill: `tiangong-lca/process-scope-statistics` (Agent Skill, multi-file: 4 files)
- Install (CLI): `npx skillmds@latest add tiangong-lca/process-scope-statistics`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tiangong-lca/process-scope-statistics/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: tiangong-lca (https://skillmd.com/u/tiangong-lca)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/tiangong-lca/process-scope-statistics

---


# process-scope-statistics

Use this skill when the task is to answer questions like:
- “这些 process 覆盖多少领域/工艺/产品？”
- “当前可见的 `state_code=0,100` process 有多少单元过程、多少产品？”
- “给我一个以后可重复跑的 process scope 统计方案”

## Workflow

1. Create an output directory first.
2. Ensure the API base URL, Supabase publishable key, and public OAuth client ID are exported, then run `tiangong-lca auth status --json`. If it returns `login-required`, stop and ask the human to run `auth login` in a trusted terminal; never request a username, password, credential, code, or token.
3. Run `node scripts/run-process-scope-statistics.mjs`.
4. Review the JSON summaries and Markdown reports in that output directory.
5. If you need a Chinese report, keep the `.zh-CN.md` output.

## Default Statistical Scope

Unless the user says otherwise, use:
- `--scope visible`
- `--state-codes 0,100`

`visible` means “all process rows visible to the current authenticated session”.
In practice this typically includes:
- draft rows owned by the current account, such as `state_code=0`
- publicly visible rows such as `state_code=100`

## Canonical Script

```bash
node scripts/run-process-scope-statistics.mjs \
  --out-dir /abs/path/process-scope-stats \
  --scope visible \
  --state-code 0 \
  --state-code 100
```

Useful options:
- `--scope current-user`
- `--state-code 0`
- `--state-code 100`
- `--page-size 200`
- `--reuse-snapshot`

The wrapper delegates to the canonical CLI command:

```bash
tiangong-lca process scope-statistics --out-dir /abs/path/process-scope-stats --scope visible --state-code 0 --state-code 100
```

Compatibility note:
- `--state-codes 0,100` is still accepted as a wrapper/CLI alias, but repeatable `--state-code` flags are the canonical shape.

## Outputs

- `inputs/processes.snapshot.manifest.json`
- `inputs/processes.snapshot.rows.jsonl`
- `outputs/process-scope-summary.json`
- `outputs/domain-summary.json`
- `outputs/craft-summary.json`
- `outputs/product-summary.json`
- `outputs/type-of-dataset-summary.json`
- `reports/process-scope-statistics.md`
- `reports/process-scope-statistics.zh-CN.md`

## Metric Definitions

Read `references/metric-definitions.md` when you need the exact counting rules for:
- domain
- craft / route
- unit process
- product

## Notes

- This is a read-only statistics skill; it does not save remote edits.
- Use a separate private session file per account/project/client. Headless execution may use only an orchestrator-injected short-lived access token that never enters argv, prompts, logs, or artifacts.
- The skill is a thin wrapper over `tiangong-lca process scope-statistics`; it does not carry a separate remote runtime or private `.env` parser.
- The metric layer is deterministic and string-based. It does not try to semantically merge cross-language variants unless they already share the same stable identifier.

