getaura 0.1.10 → 0.3.0

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.
Files changed (35) hide show
  1. package/LICENSE +126 -0
  2. package/README.md +12 -4
  3. package/THIRD-PARTY-NOTICES.md +31 -0
  4. package/dist/index.js +11970 -2565
  5. package/dist/index.js.map +1 -1
  6. package/package.json +6 -3
  7. package/plugin/skills/{scan → check}/SKILL.md +3 -3
  8. package/plugin/skills/fix/SKILL.md +4 -2
  9. package/plugin/skills/next/SKILL.md +4 -2
  10. package/plugin/skills/setup/SKILL.md +1 -1
  11. package/templates/LICENSE +16 -0
  12. package/templates/README.md +7 -3
  13. package/templates/github/workflows/aura-weekly.yml +2 -2
  14. package/templates/github/workflows/aura.yml +16 -8
  15. package/templates/github/workflows/ci.yml +2 -2
  16. package/templates/guides/add-aura-key-to-github.md +4 -4
  17. package/templates/guides/ai-spend-limits.md +50 -0
  18. package/templates/guides/database-backups.md +61 -0
  19. package/templates/guides/github-security.md +2 -2
  20. package/templates/guides/install-github-cli.md +1 -1
  21. package/templates/guides/rotate-generic-key.md +1 -1
  22. package/templates/guides/sync-migrations.md +88 -0
  23. package/templates/guides/sync-vercel-env.md +56 -0
  24. package/templates/nextjs/error.tsx +23 -0
  25. package/templates/nextjs/global-error.tsx +27 -0
  26. package/templates/nextjs/not-found.tsx +15 -0
  27. package/templates/pr/add-error-pages.md +23 -0
  28. package/templates/pr/protect-agent-secrets.md +18 -0
  29. package/templates/rules/agent-rules.md +6 -1
  30. package/templates/skills/aura/SKILL.md +18 -8
  31. package/templates/skills/error-handling/SKILL.md +2 -0
  32. package/templates/skills/folder-structure/SKILL.md +2 -1
  33. package/templates/skills/pre-launch-checklist/SKILL.md +2 -2
  34. package/templates/skills/secrets-and-env/SKILL.md +1 -1
  35. package/templates/skills/secure-api-routes/SKILL.md +5 -1
@@ -0,0 +1,23 @@
1
+ ## What this does
2
+
3
+ Adds the pages Next.js shows when something goes wrong, so visitors get a friendly message instead of a blank or broken screen:
4
+
5
+ {{details}}
6
+
7
+ They use plain words, a "Try again" button where it helps, and never show technical details such as error messages or stack traces. Existing files are left untouched.
8
+
9
+ ## Why it matters
10
+
11
+ Things break sometimes: a database is slow, a service is down, a link is old. A clear message and a way back keep visitors' trust instead of making the app look broken.
12
+
13
+ Pages that wait for data also need a loading state, so visitors can see the app is working. Those need design choices, so they aren't in this pull request: run `aura fix add-loading-states` to have your coding agent add them.
14
+
15
+ ## What to check before merging
16
+
17
+ - [ ] Open the preview deployment and visit an address that doesn't exist, such as `/this-page-does-not-exist`. You see the "Page not found" page with a link home.
18
+ - [ ] The wording and look fit your app. Edit the new files in this pull request if not.
19
+ - [ ] If your app supports several languages, move the new text into your translation files.
20
+
21
+ ---
22
+
23
+ Opened by [Aura](https://github.com/JohnFazio1/aura) · {{aura_version}}
@@ -0,0 +1,18 @@
1
+ ## What this does
2
+
3
+ Adds rules to your coding agent's settings so it can't open your `.env` files, where your keys and passwords live. It only adds rules: nothing you already set is removed or changed.
4
+
5
+ {{details}}
6
+
7
+ ## Why it matters
8
+
9
+ Coding agents read files to do their work. A key your agent reads can end up in a chat log, a pull request or a commit, and then it has to be replaced everywhere it's used.
10
+
11
+ ## What to check before merging
12
+
13
+ - [ ] Your agent never needs to read your real `.env` files. It can still read and update `.env.example`.
14
+ - [ ] Read anything under "For you to decide" and change it yourself if you didn't mean to allow it.
15
+
16
+ ---
17
+
18
+ Opened by [Aura](https://github.com/JohnFazio1/aura) · {{aura_version}}
@@ -26,8 +26,13 @@ These apply to every change.
26
26
  6. **Small, focused changes**: one concern per change. Don't refactor unrelated code or move many files at once.
27
27
  7. **Docs**: update README.md and `docs/index.md` when behaviour, setup or env vars change.
28
28
  8. **Errors**: handle failures with plain user-facing messages; never show stack traces or raw errors to users.
29
- 9. **Check your work**: run `aura scan` before finishing a big change and fix anything new it reports. Never disable or work around an Aura check without the user's agreement.
29
+ 9. **Check your work**: run `aura check` before finishing a big change and fix anything new it reports. Never disable or work around an Aura check without the user's agreement.
30
30
  10. **Plain language**: the user may be non-technical. Explain what you did and why in plain words, and say clearly when they need to do something themselves (dashboards, keys, payments).
31
+ 11. **GitHub Actions**: pin third-party actions to a full commit SHA (keep the tag as a comment), give every workflow a `permissions:` block (start from `contents: read`), and pass issue or pull request text to scripts through `env:`, never straight into `run:`.
32
+ 12. **Naming**: name new files to match the style already used in their folder (for example PascalCase for components), and name React components in PascalCase.
33
+ 13. **Colours from the theme**: use the theme's colour tokens (Tailwind classes like `bg-primary`, or `var(--token)`) instead of typing colour values into components. Add a new token when none matches, with a dark-mode value if the app has dark mode.
34
+ 14. **Logging**: never log secrets, tokens, request bodies or whole user objects, and don't leave `console.log` in code that runs in the browser.
35
+ 15. **Accessibility**: every image has alt text (empty for decorative ones), every form field has a label, and anything clickable is a button or link.
31
36
 
32
37
  ## Working efficiently
33
38
 
@@ -9,6 +9,8 @@ Aura is a CLI that scores this repo on security, agent setup, foundations and st
9
9
 
10
10
  Run `aura <command>`. If `aura` is not on the PATH, run `npx getaura <command>` instead.
11
11
 
12
+ If a command ends with "Aura X is available", run `aura update --yes` before continuing, then tell the user Aura was updated. Aura needs the user's pilot key. If a command says so, run `aura login` and ask the user to open the link it prints and paste their key there. Never ask for the key in chat.
13
+
12
14
  ## When to use it
13
15
 
14
16
  - "Check my Aura score", "how healthy is my code", "is this safe to launch"
@@ -21,22 +23,29 @@ Always use the non-interactive flags below so nothing waits for input.
21
23
 
22
24
  | Goal | Command |
23
25
  | --- | --- |
24
- | Score and findings | `aura scan --json` (add `--fast` for a quick check without type checking, linting and dead-code analysis) |
26
+ | Score and findings | `aura check --json` (add `--fast` for a quick check without type checking, linting and dead-code analysis) |
25
27
  | Recommended next steps | `aura next --json` |
26
28
  | Apply a template change as a PR | `aura apply <action> --yes` |
27
29
  | Let Aura's agent fix something | `aura fix <finding id or action> --yes` |
28
30
  | Get a task file for you to complete | `aura fix <finding id or action> --agent` |
31
+ | Continue a large change the user approved | add `--approved` to the same `aura fix` or `aura apply` command |
29
32
  | Step-by-step guide for the user | `aura guide <topic>` (list topics with `aura guide --list`) |
30
33
  | Services, env vars and owners | `aura inventory --json` |
34
+ | What kind of project Aura thinks each folder is | `aura config kind` |
35
+ | Correct it, after the user confirms | `aura config kind <kind> [folder]` (kinds: web-app, website, api, mobile-app, desktop-app, extension, cli, library; `auto` undoes it) |
31
36
  | Score trend | `aura history` |
37
+ | Update Aura to the newest version | `aura update --yes` |
32
38
 
33
39
  ## Reading the JSON
34
40
 
35
- `aura scan --json` returns:
36
- - `score` (0–100) and `cappedBy` when a critical finding capped the score.
41
+ `aura check --json` returns:
42
+ - `score` (0–100) and `cappedBy` when a critical finding capped the score. The score comes from Aura's server: `score` is `null` when it couldn't be reached, and `scoreProblem` says why. Tell the user and never guess a score; the findings are still there. `scoreSource` is `cache` when Aura reused its last score for the same code.
37
43
  - `categories[]`: `category`, `score`.
38
44
  - `checks[]`: `checkId`, `title`, `status`, `summary` and `findings[]`.
39
45
  - Each finding: `id`, `severity` (critical, high, medium, low, info), `title`, `detail`, `why`, optional `explanation`, `locations[]` (`file`, `line`) and optional `actionId`.
46
+ - In a monorepo, findings from one project start with its folder (`apps/web: …`) and have `meta.project`.
47
+ - `profile.projects[]`: what Aura scored each project as: `path`, `kind`, `traits`, `tools` and `confidence` (`low` means a best guess; check it with the user).
48
+ - `setup[]`: per project, the jobs it needs done (`capability`) with `status` (`in-place` with the `tool`, or `missing`), `need` (`essential`, `recommended`) and `why`. Advice only, not scored: mention essential gaps, and offer to help pick a tool, but never install a paid service without the user's say-so.
40
49
 
41
50
  `aura next --json` returns steps in priority order. Each step has `actionId`, `title`, `delivery` (`pr`, `agent-fix`, `guide`, `checklist`), `why`, `impact` (estimated points gained), `effort` and the exact `command` to run.
42
51
 
@@ -56,21 +65,22 @@ Always use the non-interactive flags below so nothing waits for input.
56
65
  - `agent-fix`: run `aura fix <id> --agent`, then complete the task file yourself (see below), or run `aura fix <id> --yes` if the user prefers Aura's agent.
57
66
  - `guide`: run `aura guide <topic>` and walk the user through it. These steps happen in vendor dashboards, so the user does them.
58
67
  - `checklist`: run `aura inventory --json`, show the user which services and accounts Aura found, and ask them to run `aura inventory` in their own terminal to record who owns each account.
59
- 3. After any change, run `aura scan --json` again and tell the user the new score.
68
+ 3. Large changes (renames and restructures across many files) need the user's approval first. If `aura fix` or `aura apply` stops with exit code 3 and says the change is large, show the user the breakdown it printed (also in `.aura/plans/<id>.md`) in plain words: what will change, why, what won't change, the risk and the chunks. Ask whether to go ahead. Only after they clearly say yes, run the same command again with `--approved`; `--yes` doesn't count as their approval. Each run does one chunk in one pull request. Tell the user how many chunks are left and run it again with `--approved` for the next one when they want to continue.
69
+ 4. After any change, run `aura check --json` again and tell the user the new score.
60
70
 
61
71
  ## Task files
62
72
 
63
- When `.aura/tasks/<id>.md` exists, it is your brief. Follow it exactly:
73
+ When `.aura/tasks/<id>.md` exists, it is your brief. Follow it exactly. If it starts with a breakdown of a large change, show the user that breakdown and get their yes before changing anything, and do only the chunk it names:
64
74
 
65
75
  1. Create a branch: `git checkout -b aura/<id>`.
66
76
  2. Make the change the task describes. Keep it small and focused on that task.
67
77
  3. Run the tests, lint and typecheck. Fix anything you broke.
68
78
  4. Commit, push and open a PR with `gh pr create`. Write the PR body in plain language: what changed, why it matters, and what the user should check before merging.
69
- 5. Run `aura scan --json` to confirm the finding is gone.
79
+ 5. Run `aura check --json` to confirm the finding is gone.
70
80
 
71
81
  ## Rules
72
82
 
73
- - Never disable, weaken or game a check to raise the score. This includes adding `aura-ignore` comments, editing `.aura/config.json` ignores or deleting tests, unless the user explicitly agrees after you explain the trade-off.
74
- - Never commit `.aura/report.md`, `.aura/scan.json`, `.aura/history.json` or `.aura/tasks/`. They stay local because they can describe security weaknesses.
83
+ - Never disable, weaken or game a check to raise the score. This includes adding `aura-ignore` comments, editing `.aura/config.json` ignores, changing the kind of project or deleting tests, unless the user explicitly agrees after you explain the trade-off. Change the kind only when the user says Aura got it wrong, never to make a check stop applying.
84
+ - Never commit `.aura/report.md`, `.aura/scan.json`, `.aura/history.json`, `.aura/tasks/` or `.aura/plans/`. They stay local because they can describe security weaknesses.
75
85
  - If a finding is a leaked secret, tell the user straight away and run `aura guide rotate-<service>-key`. Removing the secret from the code is not enough; it must be rotated.
76
86
  - If you think a finding is wrong, say so and explain why. Don't silently skip it.
@@ -70,6 +70,8 @@ Show `message` with `useActionState`. Show field-level validation messages next
70
70
 
71
71
  - Log unexpected errors on the server with `console.error("what failed", error)`. On Vercel they appear in the project's Logs.
72
72
  - Include context (which action, which record id), never secrets, passwords, tokens or full card or personal data.
73
+ - Log ids and messages, not whole objects: `user.id`, not `user`; never request headers, `req.body` or `await request.json()`.
74
+ - Don't leave `console.log` in client components or other browser code: anyone can open the browser console and read it. Keep `console.error` for real errors.
73
75
  - If the project uses an error tracker such as Sentry, use it instead of only `console.error`.
74
76
 
75
77
  ## External calls
@@ -38,7 +38,8 @@ Unit tests sit next to the file they test (`lib/pricing.test.ts`) or in `tests/`
38
38
  - `app/` holds routes. Keep page files thin: fetch data and render components. Put logic in `lib/` and UI in `components/`.
39
39
  - Code that uses secrets or the Supabase admin client lives in `lib/` and starts with `import "server-only";`.
40
40
  - Client components (`"use client"`) go in `components/`, not `lib/`.
41
- - One component per file. Name files in kebab-case (`project-card.tsx`) unless the repo already uses another convention.
41
+ - One component per file. Name new files in the style the other files in their folder already use (for example `ProjectCard.tsx` next to other PascalCase components). Only in a new folder with nothing to match, use kebab-case (`project-card.tsx`).
42
+ - Name React components in PascalCase (`ProjectCard`, never `projectCard`) and hooks `useSomething`. React treats a lowercase tag like `<projectCard />` as plain HTML.
42
43
  - Use the `@/` import alias instead of long relative paths (`../../../`).
43
44
  - If a file grows past about 300 lines, split it by responsibility.
44
45
  - Before creating a helper, search for an existing one. Don't create a second `utils` that does the same thing.
@@ -9,7 +9,7 @@ Work through this list with the user. Run what you can yourself, and ask the use
9
9
 
10
10
  ## 1. Aura scan
11
11
 
12
- - Run `aura scan --json`. Resolve every critical and high finding before launch (`aura next --json` shows how).
12
+ - Run `aura check --json`. Resolve every critical and high finding before launch (`aura next --json` shows how).
13
13
  - Explain any medium findings the user decides to leave, so it's a conscious choice.
14
14
 
15
15
  ## 2. Tests and build
@@ -57,4 +57,4 @@ Check that a privacy policy and terms of service page exist and are linked in th
57
57
  ## 10. After launch
58
58
 
59
59
  - Watch Vercel logs and error tracking for the first days.
60
- - Run `aura scan` after each significant change.
60
+ - Run `aura check` after each significant change.
@@ -49,4 +49,4 @@ A secret has leaked if it was committed to git (even if later deleted), pasted i
49
49
  2. Run `aura guide rotate-<service>-key` (for example `rotate-stripe-key`, `rotate-supabase-key`; `rotate-generic-key` for others) and walk the user through it. Rotating means creating a new key and deleting the old one in the service's dashboard. Only the user can do this.
50
50
  3. Remove the secret from the code and read it from `process.env` instead.
51
51
  4. Once rotated, the old key is useless, so rewriting git history is optional. Don't rewrite history or force-push without the user's agreement.
52
- 5. Run `aura scan` to confirm.
52
+ 5. Run `aura check` to confirm.
@@ -74,11 +74,15 @@ try {
74
74
  }
75
75
  ```
76
76
 
77
+ Other providers work the same way: use their official helper (`verifyWebhook` from `@clerk/nextjs/webhooks`, the `svix` `Webhook` class for Resend, `@octokit/webhooks` for GitHub), or an HMAC of the raw body compared with `crypto.timingSafeEqual`. Reading the signature header without checking it protects nothing, and parsing the body with `request.json()` first breaks the check.
78
+
77
79
  Handle each event idempotently (store `event.id` and skip duplicates); providers retry.
78
80
 
79
81
  ## Rate limiting
80
82
 
81
- Rate-limit routes that send email or SMS, check passwords or codes, call paid AI APIs, or create accounts. Use a Vercel Firewall rate limit rule or a library such as `@upstash/ratelimit`. Key the limit on user id when signed in, IP otherwise.
83
+ Rate-limit routes that send email or SMS, check passwords or codes, call paid AI APIs, or create accounts. Use a Vercel Firewall rate limit rule or a library such as `@upstash/ratelimit`. Key the limit on user id when signed in, IP otherwise. For sign-in, code and password-reset routes, key it on the IP plus the email or username being tried, so nobody can guess one account's password from many tries. Sign-in through Supabase Auth, Clerk or Auth0 is already limited by the provider.
84
+
85
+ AI routes also need a sign-in check and an output limit on every model call (`max_tokens` for OpenAI and Anthropic, `maxOutputTokens` for the AI SDK), and AI keys never go in `NEXT_PUBLIC_` variables or `'use client'` files.
82
86
 
83
87
  ## Intentionally public routes
84
88