td-ai-tools 1.5.2 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "td-ai-tools",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "Install agent skills and packs into your project",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -64,7 +64,7 @@ When a task spans several areas (a launch touches nearly all of them), follow th
64
64
  ## 4. Bundled tools
65
65
 
66
66
  - `scripts/preflight.sh [dir]`: read-only orientation report (above).
67
- - `scripts/cf-api.sh METHOD PATH [JSON]`: thin `curl` wrapper for the Cloudflare REST API. It is used for anything wrangler can't do: zones, DNS, zone settings, rulesets, bot management. It reads `CLOUDFLARE_API_TOKEN` (and `CLOUDFLARE_ACCOUNT_ID` for the `{account}` placeholder), and prints the JSON body or a readable error. Run it with no arguments for usage. Reference examples pipe its output through `jq`. If `jq` isn't installed, suggest `sudo apt install jq` (or `brew install jq`), or filter with `node -e` in the meantime.
67
+ - `scripts/cf-api.sh METHOD PATH [JSON]`: thin `curl` wrapper for the Cloudflare REST API. It is used for anything wrangler can't do: zones, DNS, zone settings, rulesets, bot management. It reads `CLOUDFLARE_API_TOKEN`, falling back to `CLOUDFLARE_TOKEN` (the TD convention, normally already set in the agent's shell), plus `CLOUDFLARE_ACCOUNT_ID` for the `{account}` placeholder, and prints the JSON body or a readable error. Run it with no arguments for usage. Reference examples pipe its output through `jq`. If `jq` isn't installed, suggest `sudo apt install jq` (or `brew install jq`), or filter with `node -e` in the meantime.
68
68
  - `scripts/verify-site.sh https://domain [--md /about.md]`: read-only post-deploy smoke test covering status codes, HTTPS/www redirects, robots.txt AI-crawler group, llms.txt, sitemap, the Markdown twin, the form token endpoint, and security headers.
69
69
  - `assets/wrangler.jsonc`: annotated starting config for a new Leyline site.
70
70
  - `assets/deploy.yml`: GitHub Actions workflow (preview on PR, deploy on main).
@@ -74,7 +74,7 @@ When a task spans several areas (a launch touches nearly all of them), follow th
74
74
  - **Build, then deploy.** `npx astro build` writes `dist/server/wrangler.json` and a redirect at `.wrangler/deploy/config.json`. A plain `npx wrangler deploy` from the site root then deploys the *built* config. Running `wrangler deploy` without a fresh build ships stale output. Don't pass `-c wrangler.jsonc` to deploy, because that bypasses the built config.
75
75
  - **Use the project's wrangler** (`npx wrangler`, pinned in `package.json`), not a global one. Flags differ between versions. If a flag in these references is rejected, run `npx wrangler <cmd> --help` and trust that over this skill.
76
76
  - **Tag deploys** with `--tag "$(git rev-parse --short HEAD)" --message "<what changed>"`. The tag and message show up in `deployments list` and make rollbacks legible.
77
- - **Never print secret values** into the transcript. Pipe them in (`printf %s "$VAL" | npx wrangler secret put NAME`) and generate random ones with `openssl rand -base64 48`. Don't echo `CLOUDFLARE_API_TOKEN`.
77
+ - **Never print secret values** into the transcript. Pipe them in (`printf %s "$VAL" | npx wrangler secret put NAME`) and generate random ones with `openssl rand -base64 48`. Don't echo `CLOUDFLARE_TOKEN` or `CLOUDFLARE_API_TOKEN`.
78
78
  - **Prefer config over clicks.** Whatever can live in `wrangler.jsonc` (routes, custom domains, bindings, observability, vars) should, so the repo describes the site. Use the API or dashboard only for zone-level things.
79
79
  - **Report what happened**: the deployed version ID, the URL, and what `verify-site.sh` showed. If a step was skipped or failed, say so plainly.
80
80
  - Cloudflare's docs are large and change often. When you need something not covered here, fetch the product's `llms.txt` (e.g. `https://developers.cloudflare.com/workers/llms.txt`) rather than guessing.
@@ -5,9 +5,11 @@ Theory Digital has a mixed setup: most sites run in the Theory Digital account,
5
5
  | Credential | Used by | Covers |
6
6
  |---|---|---|
7
7
  | **Wrangler OAuth login** (per profile) | `wrangler …` | Workers, D1, KV, R2, secrets, Turnstile, routes/custom domains |
8
- | **API token** (`CLOUDFLARE_API_TOKEN`) | `scripts/cf-api.sh`, CI, and wrangler too when set | Anything with matching permissions, including zone settings and DNS, which wrangler can't touch |
8
+ | **API token** (`CLOUDFLARE_TOKEN` locally, `CLOUDFLARE_API_TOKEN` in CI) | `scripts/cf-api.sh`, CI, and wrangler when `CLOUDFLARE_API_TOKEN` is set | Anything with matching permissions, including zone settings and DNS, which wrangler can't touch |
9
9
 
10
- **Default login: `Kyle@theorydigital.ca`.** Unless the user specifies otherwise (or the site's `account_id` belongs to a different account), assume wrangler and API work run as `Kyle@theorydigital.ca` against the Theory Digital account it owns. `npx wrangler whoami` prints the logged-in email; if it's someone else, tell the user and ask before switching (`npx wrangler logout && npx wrangler login`, or a named profile below). An API token in `CLOUDFLARE_API_TOKEN` should likewise belong to that login or be scoped to that account.
10
+ **Default login: `Kyle@theorydigital.ca`.** Unless the user specifies otherwise (or the site's `account_id` belongs to a different account), assume wrangler and API work run as `Kyle@theorydigital.ca` against the Theory Digital account it owns. `npx wrangler whoami` prints the logged-in email; if it's someone else, tell the user and ask before switching (`npx wrangler logout && npx wrangler login`, or a named profile below). An API token in `CLOUDFLARE_TOKEN` / `CLOUDFLARE_API_TOKEN` should likewise belong to that login or be scoped to that account.
11
+
12
+ **Token naming convention**: in a Theory Digital shell, the operator's Cloudflare API token is exported as **`CLOUDFLARE_TOKEN`** and is normally already available to the agent. Check for it with `[ -n "$CLOUDFLARE_TOKEN" ] && echo set` (never echo the value) before asking the user for a token. `scripts/cf-api.sh` uses `CLOUDFLARE_API_TOKEN` if set, otherwise `CLOUDFLARE_TOKEN`. Wrangler does **not** read `CLOUDFLARE_TOKEN`, so it keeps using the OAuth login. That separation is deliberate. `CLOUDFLARE_API_TOKEN` is the name for CI secrets and for one-off overrides (e.g. a client-account token).
11
13
 
12
14
  When `CLOUDFLARE_API_TOKEN` is set in the environment, **wrangler uses it instead of the OAuth login**. Most "wrong account", "Authentication error [code: 10000]" and "permission denied" confusion comes from a stale token in the shell. Check `env | grep CLOUDFLARE_` first.
13
15
 
@@ -54,7 +56,7 @@ bash scripts/cf-api.sh GET /accounts/{account}/tokens/verify # account-
54
56
  bash scripts/cf-api.sh GET '/zones?per_page=50' # which zones it sees
55
57
  ```
56
58
 
57
- Keeping the token out of the transcript: ask the user to `export CLOUDFLARE_API_TOKEN=…` in their own shell (`! export …` in Claude Code), or to store it in a gitignored file you `source`. Never put it in `wrangler.jsonc`, the repo, or a command line you echo.
59
+ Keeping the token out of the transcript: ask the user to `export CLOUDFLARE_TOKEN=…` in their own shell profile (or `! export …` in Claude Code for the session), or to store it in a gitignored file you `source`. Never put it in `wrangler.jsonc`, the repo, or a command line you echo.
58
60
 
59
61
  ## Clients' own accounts
60
62
 
@@ -73,7 +73,7 @@ bash scripts/cf-api.sh PATCH '/zones/{zone:acme.com}/dns_records/<record_id>' '{
73
73
  # delete (confirm), get the ID from the list first and show the record to the user
74
74
  bash scripts/cf-api.sh DELETE '/zones/{zone:acme.com}/dns_records/<record_id>'
75
75
  # backup the whole zone as BIND text, worth doing before bulk edits
76
- curl -sS -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" "https://api.cloudflare.com/client/v4/zones/$(bash scripts/cf-api.sh zone-id acme.com)/dns_records/export" > acme.com.zone
76
+ curl -sS -H "Authorization: Bearer ${CLOUDFLARE_API_TOKEN:-$CLOUDFLARE_TOKEN}" "https://api.cloudflare.com/client/v4/zones/$(bash scripts/cf-api.sh zone-id acme.com)/dns_records/export" > acme.com.zone
77
77
  ```
78
78
  `"ttl": 1` means "automatic". TXT content with spaces or quotes: pass it exactly as the provider gives it, and the API handles quoting.
79
79
 
@@ -13,19 +13,20 @@
13
13
  # cf-api.sh POST '/zones/{zone:acme.com}/dns_records' '{"type":"CNAME","name":"www","content":"acme.com","proxied":true}'
14
14
  # cf-api.sh PATCH '/zones/{zone:acme.com}/settings/ssl' '{"value":"strict"}'
15
15
  #
16
- # Auth: CLOUDFLARE_API_TOKEN (never printed). Output: response JSON (pretty via jq if present).
16
+ # Auth: CLOUDFLARE_API_TOKEN, else CLOUDFLARE_TOKEN (TD shell convention; never printed). Output: response JSON (pretty via jq if present).
17
17
  # Exit code 1 when the API reports success:false.
18
18
  set -euo pipefail
19
19
 
20
20
  API="https://api.cloudflare.com/client/v4"
21
21
  usage() { sed -n '2,17p' "$0" | sed 's/^# \{0,1\}//'; exit 2; }
22
22
  [ $# -lt 2 ] && usage
23
- : "${CLOUDFLARE_API_TOKEN:?Set CLOUDFLARE_API_TOKEN (see references/auth-and-accounts.md)}"
23
+ CF_TOKEN="${CLOUDFLARE_API_TOKEN:-${CLOUDFLARE_TOKEN:-}}"
24
+ [ -n "$CF_TOKEN" ] || { echo "Set CLOUDFLARE_TOKEN or CLOUDFLARE_API_TOKEN (see references/auth-and-accounts.md)" >&2; exit 2; }
24
25
 
25
26
  pretty() { if command -v jq >/dev/null; then jq .; else cat; fi; }
26
27
 
27
28
  call() { # method path [body]
28
- local args=(-sS -X "$1" "$API$2" -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" -H "Content-Type: application/json")
29
+ local args=(-sS -X "$1" "$API$2" -H "Authorization: Bearer $CF_TOKEN" -H "Content-Type: application/json")
29
30
  if [ $# -ge 3 ] && [ -n "$3" ]; then
30
31
  if [[ "$3" == @* ]]; then args+=(--data-binary "$3"); else args+=(--data "$3"); fi
31
32
  fi
@@ -78,6 +78,7 @@ fi
78
78
 
79
79
  hr "Auth"
80
80
  [ -n "${CLOUDFLARE_API_TOKEN:-}" ] && echo "CLOUDFLARE_API_TOKEN is set (wrangler will use it instead of OAuth)"
81
+ [ -n "${CLOUDFLARE_TOKEN:-}" ] && echo "CLOUDFLARE_TOKEN is set (used by cf-api.sh; wrangler ignores it)"
81
82
  [ -n "${CLOUDFLARE_ACCOUNT_ID:-}" ] && echo "CLOUDFLARE_ACCOUNT_ID=$CLOUDFLARE_ACCOUNT_ID"
82
83
  $W auth list 2>/dev/null | grep -v '^\s*$' | grep -v 'wrangler' | grep -v '^─' | sed 's/^/profiles: /' | head -10
83
84
  $W whoami 2>&1 | grep -v -E '^\s*$|wrangler [0-9]|^─|Getting User' | head -25
@@ -0,0 +1 @@
1
+ {"version":"4.1.10","results":[[":eslint-plugin-theory/src/rules/guarded-custom-element-define.test.ts",{"duration":0,"failed":true}],[":stylelint-config-theory/src/liquid/mask.test.ts",{"duration":21.486761,"failed":false}],[":theme-check-theory/src/checks/hardcoded-text.test.ts",{"duration":79.642067,"failed":false}],[":stylelint-config-theory/src/integration.test.ts",{"duration":322.234405,"failed":false}],[":theme-check-theory/src/checks/unguarded-nullable-setting.test.ts",{"duration":126.54217099999994,"failed":false}],[":eslint-plugin-theory/src/rules/disconnected-callback-cleanup.test.ts",{"duration":0,"failed":true}],[":eslint-plugin-theory/src/integration.test.ts",{"duration":207.055841,"failed":false}],[":eslint-plugin-theory/src/liquid/mask.test.ts",{"duration":31.769655,"failed":false}],[":stylelint-config-theory/src/config.test.ts",{"duration":13.856021999999996,"failed":false}],[":theme-check-theory/src/checks/unused-section-settings.test.ts",{"duration":63.80623400000002,"failed":false}],[":theme-check-theory/src/checks/unguarded-metaobject.test.ts",{"duration":34.325909000000024,"failed":false}],[":eslint-plugin-theory/src/index.test.ts",{"duration":6.773288999999977,"failed":false}],[":theme-check-theory/src/checks/disallowed-script-or-style-tag.test.ts",{"duration":32.848730000000046,"failed":false}],[":theme-check-theory/src/checks/unguarded-metafield.test.ts",{"duration":37.897699999999986,"failed":false}],[":eslint-plugin-theory/src/rules/no-class-selectors.test.ts",{"duration":0,"failed":true}],[":eslint-plugin-theory/src/rules/no-unapproved-imports.test.ts",{"duration":0,"failed":true}],[":eslint-plugin-theory/src/rules/require-jsdoc.test.ts",{"duration":87.66796799999997,"failed":false}],[":eslint-plugin-theory/src/rules/centralize-selectors.test.ts",{"duration":0,"failed":true}],[":stylelint-config-theory/src/build.test.ts",{"duration":903.9329710000001,"failed":false}],[":theme-check-theory/src/index.test.ts",{"duration":2.380390000000034,"failed":false}],[":eslint-plugin-theory/src/processors/liquid.test.ts",{"duration":6.720345000000009,"failed":false}],[":eslint-plugin-theory/src/build.test.ts",{"duration":965.007413,"failed":false}]]}