# Org Create

Shell script to create a new org folder with standard v2 structure.
**https://contexts.live/cx/tools/cx-org-create.sh**

---

## Prerequisites

- Bash
- `/cx/.cx-config.json` present with `{ "root": "/path/to/server" }`
- `cx/user/`, `cx/client/`, and `cx/tools/` must exist in the cx directory

---

## Usage

```bash
bash cx/tools/cx-org-create.sh <slug>
```

Slug must be lowercase alphanumeric with hyphens only (e.g. `my-org`).

---

## What it creates

```
org/{slug}/
    packs/              ← pack JSON files go here
    media/              ← media files go here
    css       →         ../../cx/css
    user/     →         ../../cx/user
    client/   →         ../../cx/client
    tools/    →         ../../cx/tools
    index.html →        ../../cx/tools/cx-org-index.html
    config.json         ← edit this after creation
```

---

## config.json

The script creates a template `config.json`:

```json
{
    "server": "contexts.live",
    "port": "8008",
    "slug": "my-org",
    "orgName": "",
    "orgURL": "",
    "logo": ""
}
```

Edit `orgName` at minimum. `orgURL` and `logo` are optional.

---

## Notes

- The script will refuse to run if the org already exists
- `.cx-config.json` is at `/cx/.cx-config.json` — one level above the script
- For v1 orgs (using `units/` and `local/`), use `org-index.html` — this script creates v2 orgs only
- Per-org custom pages go in `org/{slug}/local/` (not created by the script — create manually if needed)
