passflow 0.0.0-stage → 0.2.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 (65) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -2
  3. package/dist/cli.mjs +1759 -0
  4. package/package.json +42 -3
  5. package/skills/REVISION +1 -0
  6. package/skills/index.json +405 -0
  7. package/skills/passflow-nextjs/SKILL.md +205 -0
  8. package/skills/passflow-nextjs/assets/.env.example +5 -0
  9. package/skills/passflow-nextjs/assets/app/account/page.tsx +29 -0
  10. package/skills/passflow-nextjs/assets/app/actions.example.ts +21 -0
  11. package/skills/passflow-nextjs/assets/app/api/me/route.ts +22 -0
  12. package/skills/passflow-nextjs/assets/components/auth-links.tsx +11 -0
  13. package/skills/passflow-nextjs/assets/lib/call-api.example.ts +15 -0
  14. package/skills/passflow-nextjs/assets/lib/passflow.ts +4 -0
  15. package/skills/passflow-nextjs/assets/proxy.ts +10 -0
  16. package/skills/passflow-nextjs/references/guardrails.md +87 -0
  17. package/skills/passflow-nextjs/scripts/index.json +405 -0
  18. package/skills/passflow-nextjs/scripts/lib.sh +1069 -0
  19. package/skills/passflow-nextjs/scripts/verify.sh +467 -0
  20. package/skills/passflow-node-api/SKILL.md +189 -0
  21. package/skills/passflow-node-api/assets/examples/explain-rejection.ts +22 -0
  22. package/skills/passflow-node-api/assets/examples/express-routes.ts +22 -0
  23. package/skills/passflow-node-api/assets/examples/fastify-routes.ts +28 -0
  24. package/skills/passflow-node-api/assets/examples/hono-routes.ts +19 -0
  25. package/skills/passflow-node-api/assets/src/express-cors.ts +11 -0
  26. package/skills/passflow-node-api/assets/src/express.ts +13 -0
  27. package/skills/passflow-node-api/assets/src/fastify-cors.ts +11 -0
  28. package/skills/passflow-node-api/assets/src/fastify.ts +14 -0
  29. package/skills/passflow-node-api/assets/src/fetch-handler.ts +13 -0
  30. package/skills/passflow-node-api/assets/src/hono-cors.ts +11 -0
  31. package/skills/passflow-node-api/assets/src/hono.ts +16 -0
  32. package/skills/passflow-node-api/assets/src/passflow.ts +21 -0
  33. package/skills/passflow-node-api/references/guardrails.md +66 -0
  34. package/skills/passflow-node-api/scripts/index.json +405 -0
  35. package/skills/passflow-node-api/scripts/lib.sh +1069 -0
  36. package/skills/passflow-node-api/scripts/verify.sh +283 -0
  37. package/skills/passflow-react-vite/SKILL.md +225 -0
  38. package/skills/passflow-react-vite/assets/server/express-cors.ts +9 -0
  39. package/skills/passflow-react-vite/assets/server/express.ts +14 -0
  40. package/skills/passflow-react-vite/assets/server/fastify-cors.ts +11 -0
  41. package/skills/passflow-react-vite/assets/server/fastify.ts +15 -0
  42. package/skills/passflow-react-vite/assets/server/hono-cors.ts +8 -0
  43. package/skills/passflow-react-vite/assets/server/hono.ts +17 -0
  44. package/skills/passflow-react-vite/assets/server/passflow.ts +30 -0
  45. package/skills/passflow-react-vite/assets/server/tsconfig.json +14 -0
  46. package/skills/passflow-react-vite/assets/src/passflow.tsx +28 -0
  47. package/skills/passflow-react-vite/assets/src/require-sign-in.tsx +35 -0
  48. package/skills/passflow-react-vite/assets/src/use-api.ts +23 -0
  49. package/skills/passflow-react-vite/references/guardrails.md +82 -0
  50. package/skills/passflow-react-vite/scripts/index.json +405 -0
  51. package/skills/passflow-react-vite/scripts/lib.sh +1069 -0
  52. package/skills/passflow-react-vite/scripts/verify.sh +678 -0
  53. package/skills/passflow-tanstack-start/SKILL.md +182 -0
  54. package/skills/passflow-tanstack-start/assets/.env.example +5 -0
  55. package/skills/passflow-tanstack-start/assets/src/components/auth-links.tsx +10 -0
  56. package/skills/passflow-tanstack-start/assets/src/lib/call-api.example.ts +14 -0
  57. package/skills/passflow-tanstack-start/assets/src/lib/passflow.ts +14 -0
  58. package/skills/passflow-tanstack-start/assets/src/lib/server-functions.example.ts +20 -0
  59. package/skills/passflow-tanstack-start/assets/src/routes/account.tsx +25 -0
  60. package/skills/passflow-tanstack-start/assets/src/routes/api/me.ts +25 -0
  61. package/skills/passflow-tanstack-start/assets/src/start.ts +14 -0
  62. package/skills/passflow-tanstack-start/references/guardrails.md +73 -0
  63. package/skills/passflow-tanstack-start/scripts/index.json +405 -0
  64. package/skills/passflow-tanstack-start/scripts/lib.sh +1069 -0
  65. package/skills/passflow-tanstack-start/scripts/verify.sh +470 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MadAppGang Pty Ltd
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,68 @@
1
- # Temporary Holding Version
1
+ # passflow
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The Passflow CLI. One command adds the Passflow pieces to an app, so your coding agent can then add sign-in:
4
+
5
+ ```bash
6
+ npx passflow integrate
7
+ ```
8
+
9
+ It makes no model calls. It:
10
+
11
+ 1. **Detects the stack** from `package.json`: TanStack Start (1.169.5 or newer, with TanStack Router 1.170.46 or newer), Next.js App Router (16 or newer),
12
+ React + Vite with a Node API, or a Node API on Express, Fastify or Hono. It also detects the package manager:
13
+ npm, pnpm and Yarn 1 (classic) are supported. A project it can't handle is refused before anything is created.
14
+ 2. **Checks the env file** (`.env.local`, or `.env` for a Node API). A file git tracks, a symlink, or a file with
15
+ only some of the Passflow settings is refused. A file that has all of them creates no second app. In a git
16
+ checkout git must answer: when it can't run or refuses the repository, the project is refused. A `.gitignore`
17
+ that is a symlink is refused when a line has to be added, and a skill destination that is a symlink is refused
18
+ too. All of this happens before anything is created.
19
+ An existing skill folder is replaced only when its `.passflow-skill.json` manifest still matches every file in it; one without a manifest, or with a file changed, added or removed, stops the run so you can move or delete it.
20
+ 3. **Signs you in.** In your browser by default (Passflow Cloud). With `PASSFLOW_API_KEY`, an organization API key
21
+ with write access, there is no browser. For a self-hosted Passflow, pass `--server` and `--management-key`.
22
+ 4. **Creates the app** for the stack: a `bff` app for Next.js and TanStack Start, an `spa` app for React + Vite.
23
+ A Node API gets no app of its own; it asks for the issuer and client ID of the app whose tokens it accepts. On
24
+ Passflow Cloud the app goes into the project's non-production environment unless `--env` names another.
25
+ 5. **Writes the env file**, last: only the names it lacks, never a changed line. `PASSFLOW_SECRET` is generated on
26
+ your machine. The env file is added to `.gitignore` when nothing there covers it. `.env.example` gets the same
27
+ names, with the public values filled in and the secrets left empty. In a git checkout, git must confirm it
28
+ ignores the env file before a secret is written. An env file the CLI writes to is set to mode 600 first, and
29
+ the CLI says so when it changes the mode.
30
+ On Windows, where a mode doesn't set who can read the file, the CLI warns you before it writes a secret and asks you to check that only your account can read the file.
31
+ 6. **Installs the agent skill** for the stack into `.claude/skills/<skill>/` and `.agents/skills/<skill>/`, with a
32
+ `.passflow-skill.json` manifest that records the `usepassflow/skills` commit the bundled skills came from and each file's sha256.
33
+ A folder that already matches the bundled copy is left alone and reported as up to date.
34
+ 7. **Hands off.** With `--agent claude`, `codex` or `cursor-agent` it starts that agent with a fixed prompt;
35
+ otherwise it prints the prompt. The agent's environment has no `PASSFLOW_API_KEY` or management key.
36
+
37
+ The CLI prints no secret. The client secret and `PASSFLOW_SECRET` are written to the env file and nowhere else, and
38
+ the sign-in token and keys stay in memory. A call that carries a credential follows no redirect: a redirect
39
+ stops the run with a message. Prefer `PASSFLOW_MANAGEMENT_KEY` to `--management-key`, which stays in shell
40
+ history and shows in `ps`.
41
+
42
+ ## Options
43
+
44
+ ```text
45
+ passflow integrate [options]
46
+
47
+ Passflow Cloud: --org <id> --project <key> --env <slug> --cloud-url <url>
48
+ Self-hosted: --server <url> --management-key <key> (or PASSFLOW_MANAGEMENT_KEY)
49
+ The app: --dir <path> --base-url <url> --api-url <url> --issuer <url> --audience <client id>
50
+ Hand-off: --agent claude|codex|cursor-agent | --no-agent
51
+ ```
52
+
53
+ `--base-url` defaults to the stack's dev URL (`http://localhost:3000`, or `http://localhost:5173` for React +
54
+ Vite) and becomes the app's redirect URLs (`<base>/auth/callback` and `<base>/`). It must be an origin: a
55
+ path, a query or a fragment is refused, because the SDK sends its callback at the origin's `/auth/callback`. `--api-url` is the API origin
56
+ React + Vite writes to `VITE_API_URL` when that name is absent (default `http://localhost:8086`).
57
+
58
+ Exit status: 0 done, 1 failed, 2 refused (the project or the options) before anything was created.
59
+
60
+ ## The skills
61
+
62
+ The skills come from [`usepassflow/skills`](https://github.com/usepassflow/skills). Each release of this package
63
+ ships one pinned copy of them under `skills/`, and `skills/index.json` holds the detection rules the CLI uses.
64
+ `node scripts/vendor-skills.mjs <skills checkout>` refreshes the copy.
65
+
66
+ ## Licence
67
+
68
+ MIT