affitor 0.4.4 → 0.4.6

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 (44) hide show
  1. package/README.md +144 -5
  2. package/dist/cli.js +2 -0
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/agent.d.ts +3 -0
  5. package/dist/commands/agent.d.ts.map +1 -0
  6. package/dist/commands/agent.js +117 -0
  7. package/dist/commands/agent.js.map +1 -0
  8. package/dist/commands/init.js +1 -1
  9. package/dist/commands/init.js.map +1 -1
  10. package/dist/commands/onboard.d.ts +39 -0
  11. package/dist/commands/onboard.d.ts.map +1 -1
  12. package/dist/commands/onboard.js +232 -22
  13. package/dist/commands/onboard.js.map +1 -1
  14. package/dist/commands/setup-stripe.d.ts +1 -1
  15. package/dist/commands/setup-stripe.d.ts.map +1 -1
  16. package/dist/commands/setup-stripe.js +2 -2
  17. package/dist/commands/setup-stripe.js.map +1 -1
  18. package/dist/commands/status.js +2 -2
  19. package/dist/commands/status.js.map +1 -1
  20. package/dist/lib/agent-launcher.d.ts +20 -0
  21. package/dist/lib/agent-launcher.d.ts.map +1 -0
  22. package/dist/lib/agent-launcher.js +130 -0
  23. package/dist/lib/agent-launcher.js.map +1 -0
  24. package/dist/lib/agent-setup.d.ts +52 -0
  25. package/dist/lib/agent-setup.d.ts.map +1 -0
  26. package/dist/lib/agent-setup.js +374 -0
  27. package/dist/lib/agent-setup.js.map +1 -0
  28. package/dist/lib/config.js +2 -2
  29. package/dist/lib/program-agent-client.d.ts +38 -0
  30. package/dist/lib/program-agent-client.d.ts.map +1 -0
  31. package/dist/lib/program-agent-client.js +172 -0
  32. package/dist/lib/program-agent-client.js.map +1 -0
  33. package/dist/lib/project-env.d.ts +10 -0
  34. package/dist/lib/project-env.d.ts.map +1 -0
  35. package/dist/lib/project-env.js +85 -0
  36. package/dist/lib/project-env.js.map +1 -0
  37. package/dist/lib/wizard.d.ts +2 -0
  38. package/dist/lib/wizard.d.ts.map +1 -1
  39. package/dist/lib/wizard.js +13 -1
  40. package/dist/lib/wizard.js.map +1 -1
  41. package/dist/types.d.ts +2 -0
  42. package/dist/types.d.ts.map +1 -1
  43. package/dist/types.js.map +1 -1
  44. package/package.json +4 -3
package/README.md CHANGED
@@ -2,13 +2,152 @@
2
2
 
3
3
  CLI-native affiliate tracking. Connect Stripe, track commissions, manage partners -- all from your terminal.
4
4
 
5
+ ## AI agent setup
6
+
7
+ Preview the selected client's installation from your project root. Sign in using
8
+ Affitor's existing login command, then apply the plan:
9
+
10
+ ```bash
11
+ affitor login
12
+ affitor agent setup --client claude_code --program-id 123 --dry-run --json
13
+ affitor agent setup --client claude_code --program-id 123 --yes
14
+ affitor doctor --client claude_code --json
15
+ ```
16
+
17
+ `--program-id` is optional when `.affitor/config.json` already links a program.
18
+ An interactive terminal can select a program from the signed-in account's list.
19
+ Without a linked/selected program, setup remains a local installer using an existing
20
+ program key and explains how to rerun for separate agent credentials. It does not
21
+ mint a key in this mode. Existing per-client setups cannot be downgraded to this
22
+ legacy mode: pass the program id when updating them. This feature requires the CMS program-agent API release;
23
+ a missing route or insufficient Owner access fails without falling back to a live key.
24
+
25
+ Choose `claude_code`, `cursor`, or `codex`; repeat `--client` for more than one.
26
+ Detected clients are not selected automatically. Inside an agent, setup can only
27
+ configure itself. Noninteractive runs require a selection and `--yes` (or
28
+ `--auto-confirm`). `--dry-run` makes no API calls and writes nothing. Without consent,
29
+ setup exits1. A linked project with no valid saved login returns `needs_login`
30
+ (exit1), with no minted key or local write. Run `affitor login` and retry.
31
+
32
+ For a selected program, each client gets its own restricted `aff_ag_` credential.
33
+ Only an active program Owner can mint/list/revoke it through the user-JWT lifecycle
34
+ API. Neither `--api-key` nor inherited `AFFITOR_API_KEY` is used as that user JWT.
35
+ Setup lists existing credentials to reuse a matching active local key, without
36
+ calling readiness/status or marking an agent connected. Revoked or missing rows
37
+ are replaced on the next approved setup. The keys permit readiness, status,
38
+ synthetic checks, clicks and test-only leads. The server forces agent leads into
39
+ test mode; they cannot settle real customer attribution or authorize sale/refund.
40
+
41
+ Private credentials live at `.affitor/agents/<client>.json` (mode0600 on POSIX),
42
+ separate from the application's live key in `.affitor/.env`. Setup preserves the
43
+ application key. The JSON includes the key's id, program, client, API origin and
44
+ an unverified scope/date note. Do not commit or share this file. A selected
45
+ credential belonging to another program/origin must be revoked and removed before
46
+ switching. Unsafe paths, malformed private files, POSIX permissions broader than
47
+ owner-only and Git-tracked private credentials are refused. Git must confirm an untracked
48
+ path in a worktree or an actual directory outside any repository. A timeout,
49
+ missing executable, unreadable repository or unexpected exit blocks setup before
50
+ any API call or write.
51
+
52
+ On Windows, POSIX mode0600 does not establish private Windows access-control
53
+ permissions, and the CLI does not configure or audit those permissions. Keep the
54
+ project under your Windows user profile in a folder with restricted access.
55
+ Check inherited permissions before storing credentials or backups in shared
56
+ folders. The owner-only mode checks above apply to macOS and Linux.
57
+
58
+ Claude Code uses project `.mcp.json`; Cursor uses `.cursor/mcp.json`. Their entries
59
+ contain only `node`, an absolute `.affitor/agent-mcp.cjs` path and a client selector.
60
+ No credential appears in MCP config, the launcher, skill, plan or command output.
61
+ The launcher reads only the selected client's private file, ignoring inherited or
62
+ application keys. A missing/invalid selected key fails closed. Its API origin comes
63
+ from that private record. It never reads a user login token. Legacy entries with no
64
+ client selector still read inherited `AFFITOR_API_KEY`, then `.affitor/.env`, using
65
+ the same strict env parser as static doctor. Their API origin remains production.
66
+
67
+ Agent setup sends the signed-in user's JWT only to `https://api.affitor.com`;
68
+ other remote HTTPS origins and other Affitor subdomains are refused before any
69
+ request. For local development, set `AFFITOR_AGENT_DEV_API_ORIGIN` to the exact
70
+ HTTP(S) loopback origin and pass the same value through `--api-url` (for example,
71
+ `http://127.0.0.1:1337`). Only `localhost`, `127.0.0.1` and `[::1]` are supported;
72
+ the port must match. This variable cannot authorize an external host. Use a
73
+ development login for that local server. The launcher still reads only its
74
+ selected program credential, not the login JWT.
75
+
76
+ Existing unrelated settings are preserved. Changed file bytes are backed up under
77
+ `.affitor/backups/` before replacement, with mode0600. Credential, login-token and
78
+ backup ignores are appended to root and child `.gitignore` files; strict `*`
79
+ guards protect private agent files and backups before the first secret write.
80
+ Temporary writes stay under the ignored backup directory, including after abrupt
81
+ termination. Updates use atomic replacement and read-back, rolling back prior writes
82
+ on failure. Concurrent edits are preserved, with private ignore guards retained.
83
+ Inspect files and private backups before retrying. This handles ordinary local
84
+ edits; it is not a sandbox against hostile local filesystem races.
85
+
86
+ Mint requests are never retried automatically. If a later mint or local write
87
+ fails, setup attempts to revoke every newly minted key whose id it received.
88
+ `revoke_failed_ids` lists known ids needing dashboard cleanup;
89
+ `mint_outcome_unknown: true` means a lost/failed response may have created another
90
+ Waiting row. Review unused Waiting credentials in Settings → Agents and revoke them
91
+ before retrying. An unknown mint result is not reported as a successful rollback.
92
+ Reuse does not revoke pre-existing keys when a local update fails.
93
+
94
+ The preview notes include active-key replacement and revocation before you confirm
95
+ the plan. If a saved id is still active for the selected client but its server hint
96
+ has changed, approved setup saves a replacement first, then revokes that old id.
97
+ Other clients' keys are not revoked. A failed mint or local update leaves the old
98
+ key in place and compensates only newly minted credentials. If old-key revocation
99
+ cannot be confirmed after saving, the new credentials stay installed and the error's
100
+ `revoke_failed_ids` identifies the previous keys that need cleanup. Setup reports
101
+ this partial completion without claiming that the new files were rolled back.
102
+
103
+ An abrupt interruption, such as closing the terminal after minting, may also leave
104
+ a Waiting credential even when no error JSON was printed and no local credential
105
+ file exists, or leave a previous key unrevoked after its replacement was saved.
106
+ Before retrying, review newly created Waiting rows for the selected
107
+ client in Settings → Agents and revoke unused credentials from that attempt.
108
+ Keep credentials used by other agents. Then run a fresh dry-run and approve setup
109
+ again; a static `doctor` result cannot prove that a server credential was cleaned up.
110
+
111
+ A recovery skill is installed in `.claude/skills/affitor/` or `.cursor/skills/affitor/`.
112
+ Codex gets `.agents/skills/affitor/` and a printed command; setup does not edit its
113
+ TOML or run the command. On Windows, add the MCP in Codex settings using the exact
114
+ command/argument array in `entries.codex` from the preview. No shell command is
115
+ printed. On macOS/Linux the printed command uses POSIX quoting. Paths are specific
116
+ to this machine: keep generated configs local or regenerate after moving the
117
+ project or on a teammate's machine.
118
+
119
+ **Installed is not verified.** Credential setup returns `needs_next_step` (exit0);
120
+ local-only installation returns `needs_human` (exit0). Setup does not run an agent,
121
+ call readiness, or infer Verified from installation. Restart the client and ask:
122
+ “Call affitor_readiness from Affitor and tell me the result.” Check the program
123
+ identity and report only checks that actually pass. Approve synthetic checks and
124
+ other writes separately.
125
+
126
+ `doctor` is read-only and static: it does not start an agent or connect to the API.
127
+ It returns `aligned`/`stale`/`missing`/`manual`/`invalid` per client and
128
+ `present_unverified`/`missing` for credentials. With no selection it checks existing
129
+ JSON client configs; an agent caller checks itself. Exit0 means selected static
130
+ checks align, credentials are present and no warning exists. Codex stays manual.
131
+ A `credential_check_failed` warning means tracking could not be checked and returns
132
+ exit1; fix Git access and retry. A `credential_tracked` warning also returns exit1; Git checks include parent repository
133
+ roots and do not change the index. Rotate exposed keys and resolve tracking/history
134
+ through your repository process; an ignore rule does not untrack them.
135
+
136
+ The launcher starts pinned `@affitor/mcp@0.2.2` with sale/refund tools disabled even
137
+ when the parent sets `AFFITOR_MCP_WRITE=1`. Windows uses a constant `cmd.exe` command
138
+ with `NoDefaultCurrentDirectoryInExePath=1`; paths/keys stay outside shell text.
139
+ The child receives only runtime paths, home/temp, locale/terminal settings, its
140
+ credential and explicit origin. Parent proxy, Node options, npm overrides and
141
+ unrelated credentials are dropped; npm uses the public registry. Project code,
142
+ PATH, `.npmrc` and the launcher remain part of your trusted local environment.
143
+
5
144
  ## Quick Start
6
145
 
7
146
  ```bash
8
147
  # Create your affiliate program
9
148
  npx affitor init
10
149
 
11
- # Connect Stripe in the Affitor dashboard: program Settings, Connect Stripe
150
+ # Connect Stripe in the Affitor dashboard: Program settings → Payments, Connect Stripe
12
151
 
13
152
  # Check program health
14
153
  npx affitor status
@@ -25,7 +164,7 @@ npx affitor test sale
25
164
  |---|---|
26
165
  | `affitor init` | Create a new affiliate program. Interactive prompts or `--no-interactive` with flags. |
27
166
  | `affitor onboard` | Wire Affitor into an existing app end-to-end: detect → install browser tracking → inject the Stripe sale call → verify. |
28
- | `affitor setup stripe` | Points you to the dashboard, where Stripe is connected (program Settings, Connect Stripe). Exits 1. |
167
+ | `affitor setup stripe` | Points you to the dashboard, where Stripe is connected (Program settings → Payments, Connect Stripe). Exits 1. |
29
168
  | `affitor setup dns` | Set up DNS CNAME tracking (coming soon). |
30
169
  | `affitor status` | Show program health: DNS, Stripe connection, recent events. |
31
170
  | `affitor test [type]` | Send a test event (`click`, `lead`, or `sale`). |
@@ -43,10 +182,10 @@ It runs the **detect → wire → inject → verify** flow:
43
182
 
44
183
  1. **Detect** — your framework (`next-app`, `next-pages`, `fastify`, `express`, `node`) and payment provider (Stripe, …).
45
184
  2. **Wire** — installs `@affitor/sdk`, injects `<AffitorTracker/>` browser tracking, scaffolds the server client, and persists `AFFITOR_API_KEY` into `.env.local`/`.env`.
46
- 3. **Inject** — locates your Stripe webhook and adds the `affitor.trackSale` call (shown as a diff; non-Stripe stacks and unrecognized webhooks get the exact recipe printed instead — payment code is never auto-edited blindly).
185
+ 3. **Review sale tracking** — if the program has a Stripe account bound in Affitor, the webhook stays unchanged to avoid a second sale path. When the runtime key or Connect state is uncertain, the CLI asks whether to keep the existing webhook unchanged (default Yes). Only choose No after confirming the runtime program key and ruling out current/shared-account/delayed Connect sales; a separate diff approval is required before adding `affitor.trackSale`. Unknown status never recommends removing an existing sale call. `--yes`, `--no-interactive` and `--json` leave Stripe webhooks unchanged when Connect cannot be ruled out. A conflicting runtime API key always requires manual review. Non-Stripe stacks and unrecognized webhooks get a recipe to review and add manually.
47
186
  4. **Verify** — fires the synthetic click → lead → sale chain, then **polls readiness until `integration_verified`** (or reports the blocking gate + next action).
48
187
 
49
- It is **idempotent** — re-running skips work already done (existing env key, sale call already present) and never overwrites a different `AFFITOR_API_KEY`.
188
+ It is **idempotent** — re-running skips work already done (existing env key, sale call already present) and never overwrites a different `AFFITOR_API_KEY`. The CLI trusts status only when the inherited process key and standard env layers declare one distinct usable key matching the checked key. It parses dotenv syntax (including colon assignments and quoted multiline values) without evaluating or expanding it. Duplicate assignments, conflicting keys across `.env`, `.env.local`, and `.env.{production,development,test}[.local]`, unreadable/nonregular files, or any other root `.env*` file make the runtime key uncertain. This includes custom modes and templates: the CLI does not infer how they are loaded. In interactive mode it asks and defaults to keeping the existing snippet; unattended runs keep it unchanged. Ambiguous env files are never overwritten. If no runtime key exists and every standard layer is readable, the normal env initialization can still add the explicit program key.
50
189
 
51
190
  | Flag | Description |
52
191
  |---|---|
@@ -93,7 +232,7 @@ Running `npx affitor init` creates:
93
232
 
94
233
  ## Stripe
95
234
 
96
- Stripe is connected from the Affitor dashboard (program Settings, Connect Stripe), not from the CLI. Affitor's own webhook then records sales and renewals; add Affitor metadata to your checkout so sales are attributed reliably.
235
+ Stripe is connected from the Affitor dashboard (Program settings → Payments, Connect Stripe), not from the CLI. Affitor's own webhook then records sales and renewals; add Affitor metadata to your checkout so sales are attributed reliably.
97
236
 
98
237
  ## Requirements
99
238
 
package/dist/cli.js CHANGED
@@ -12,6 +12,7 @@ import { registerSetupCommand } from "./commands/setup-stripe.js";
12
12
  import { registerStatusCommand } from "./commands/status.js";
13
13
  import { registerTestCommand } from "./commands/test.js";
14
14
  import { registerProgramsCommand } from "./commands/programs.js";
15
+ import { registerAgentCommands } from "./commands/agent.js";
15
16
  // Read the version from package.json at runtime so `affitor --version` never
16
17
  // drifts from the published package version (dist/cli.js → ../package.json).
17
18
  const { version } = createRequire(import.meta.url)("../package.json");
@@ -62,5 +63,6 @@ registerSetupCommand(program);
62
63
  registerStatusCommand(program);
63
64
  registerTestCommand(program);
64
65
  registerProgramsCommand(program);
66
+ registerAgentCommands(program);
65
67
  program.parse();
66
68
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","s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,OAAO,CAAC,CAAC;AAC9B,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAC/B,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAC/B,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC7B,sBAAsB,CAAC,OAAO,CAAC,CAAC;AAChC,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAC9B,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAC/B,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAC7B,uBAAuB,CAAC,OAAO,CAAC,CAAC;AACjC,qBAAqB,CAAC,OAAO,CAAC,CAAC;AAE/B,OAAO,CAAC,KAAK,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Command } from "commander";
2
+ export declare function registerAgentCommands(program: Command): void;
3
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/commands/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYzC,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,QA+FrD"}
@@ -0,0 +1,117 @@
1
+ import { checkbox, confirm, select } from "@inquirer/prompts";
2
+ import { existsSync } from "node:fs";
3
+ import { join } from "node:path";
4
+ import { CLIENTS, applySetup, callerClient, doctor, planSetup, selectedClients, setupProgramId } from "../lib/agent-setup.js";
5
+ import { readCredentials } from "../lib/config.js";
6
+ import { DEFAULT_API_URL } from "../types.js";
7
+ import { AgentSetupError, ProgramAgentClient, agentApiOrigin, installProgramAgents } from "../lib/program-agent-client.js";
8
+ import { getFlags } from "../lib/flags.js";
9
+ export function registerAgentCommands(program) {
10
+ program.command("agent").description("Configure an AI coding agent for this project")
11
+ .command("setup")
12
+ .description("Preview and install project-scoped MCP configuration and an Affitor skill")
13
+ .option("--client <name>", "claude_code, cursor or codex (repeat to select)", (value, prior) => [...prior, value], [])
14
+ .option("--program-id <id>", "Use this program for independent agent credentials (otherwise use the linked project)")
15
+ .option("--dry-run", "Show the plan without writing files")
16
+ .option("--yes", "Apply the selected client's plan")
17
+ .action(async (opts, cmd) => {
18
+ const flags = getFlags(cmd);
19
+ try {
20
+ let clients = selectedClients(opts.client ?? [], process.env);
21
+ const interactive = Boolean(process.stdin.isTTY && process.stdout.isTTY && !flags.noInteractive && !flags.json);
22
+ if (!clients.length && interactive && !opts.dryRun) {
23
+ clients = selectedClients(await checkbox({
24
+ message: "Which agents should get Affitor in this project?",
25
+ choices: CLIENTS.map(value => ({ value, name: `${value}${existsSync(join(process.cwd(), value === "claude_code" ? ".claude" : value === "cursor" ? ".cursor" : ".agents")) ? " (project directory found)" : ""}`, checked: false })),
26
+ }), process.env);
27
+ }
28
+ let programId = setupProgramId(process.cwd(), opts.programId);
29
+ const origin = agentApiOrigin(flags.apiUrl ?? DEFAULT_API_URL);
30
+ if (!programId && clients.length && interactive && !opts.dryRun) {
31
+ const session = readCredentials();
32
+ if (session?.token && Number.isFinite(Date.parse(session.expires_at)) && Date.parse(session.expires_at) > Date.now()) {
33
+ const choices = await new ProgramAgentClient(session.token, origin).programs();
34
+ if (choices.length)
35
+ programId = await select({ message: "Which program should these agents use?", choices: choices.map(row => ({ value: row.id, name: `${row.name} (${row.id})` })) });
36
+ }
37
+ }
38
+ const plan = planSetup(process.cwd(), clients, { agentKeys: programId !== null });
39
+ // Never serialize plan.actions.content: existing configs can contain
40
+ // unrelated credentials that must stay local, including in a dry-run.
41
+ const preview = {
42
+ project: plan.project, clients, caller: callerClient(process.env) ?? null,
43
+ entries: Object.fromEntries(clients.map(client => [client, { command: plan.entry.command, args: [...plan.entry.args, ...(programId !== null ? [client] : [])] }])),
44
+ entry: plan.entry, mcpVersion: plan.mcpVersion, program_id: programId, api_url: origin,
45
+ agent_keys: plan.agentKeys?.map(({ client, path, state }) => ({ client, path, state })),
46
+ actions: plan.actions.map(({ path, operation, backup }) => ({ path, operation, backup })),
47
+ manual: plan.manual, notes: plan.notes,
48
+ };
49
+ let status = opts.dryRun ? "planned" : "needs_confirmation";
50
+ if (!flags.json)
51
+ process.stdout.write(JSON.stringify(preview, null, 2) + "\n");
52
+ let approved = Boolean(opts.yes || flags.autoConfirm);
53
+ if (!opts.dryRun && clients.length && !approved && interactive) {
54
+ approved = await confirm({ message: "Apply this plan? Existing files are backed up first.", default: false });
55
+ }
56
+ if (!opts.dryRun && approved && clients.length) {
57
+ if (programId !== null) {
58
+ const session = readCredentials();
59
+ if (!session?.token || !Number.isFinite(Date.parse(session.expires_at)) || Date.parse(session.expires_at) <= Date.now())
60
+ status = "needs_login";
61
+ else {
62
+ const installed = await installProgramAgents(plan, programId, new ProgramAgentClient(session.token, origin));
63
+ preview.agent_keys = installed.map(({ client, path, state }) => ({ client, path, state }));
64
+ status = "needs_next_step";
65
+ }
66
+ }
67
+ else {
68
+ applySetup(plan);
69
+ status = "needs_human";
70
+ }
71
+ }
72
+ const next = !clients.length
73
+ ? "Select --client claude_code, cursor or codex. Detected agents are not selected automatically."
74
+ : status === "needs_login"
75
+ ? "Run affitor login, then rerun this setup command. No agent key was minted or local files written."
76
+ : status === "needs_confirmation" || status === "planned"
77
+ ? `Review the plan, then rerun affitor agent setup --client <name>${programId !== null ? ` --program-id ${programId}` : ""} --yes with the same API origin.`
78
+ : status === "needs_next_step"
79
+ ? "Installed, not verified. Restart the selected agent and ask it: Call affitor_readiness from Affitor and tell me the result. For Codex, first follow its printed manual configuration instructions."
80
+ : "Local installer only: link a program with affitor init or rerun with --program-id <id> to mint separate agent credentials. Installed is not verified. Configure the program key privately as AFFITOR_API_KEY or in .affitor/.env; restart the selected agent, then ask it to call affitor_readiness. For Codex, first follow the printed manual configuration instructions.";
81
+ if (flags.json)
82
+ process.stdout.write(JSON.stringify({ status, ...preview, next }) + "\n");
83
+ else
84
+ process.stdout.write(`${status}\n${next}\n`);
85
+ process.exitCode = (status === "needs_confirmation" || status === "needs_login") || (!clients.length && !opts.dryRun) ? 1 : 0;
86
+ }
87
+ catch (error) {
88
+ // Expected installer errors contain only fixed messages and relative
89
+ // client paths. Do not print arbitrary fs/JSON/credential exceptions.
90
+ const message = error instanceof AgentSetupError ? error.message : error instanceof Error && /^(Unknown client|An agent can only|\.mcp\.json |\.cursor\/mcp\.json |Setup failed|A setup file|Unsafe setup|Setup target)/.test(error.message)
91
+ ? error.message : "Agent setup could not finish. Check the project paths and run a fresh dry-run.";
92
+ process.stdout.write(JSON.stringify({ status: "error", message, ...(error instanceof AgentSetupError ? { revoke_failed_ids: error.cleanupIds, mint_outcome_unknown: error.uncertainMint } : {}) }) + "\n");
93
+ process.exitCode = 1;
94
+ }
95
+ });
96
+ program.command("doctor").description("Read-only static check of local agent configuration; does not verify a running session")
97
+ .option("--client <name>", "Check one client (repeat to select)", (value, prior) => [...prior, value], [])
98
+ .action((opts, cmd) => {
99
+ try {
100
+ const clients = selectedClients(opts.client ?? [], process.env);
101
+ const configured = CLIENTS.filter(client => client !== "codex" && existsSync(join(process.cwd(), client === "claude_code" ? ".mcp.json" : ".cursor/mcp.json")));
102
+ const results = doctor(process.cwd(), clients.length ? clients : configured.length ? configured : ["claude_code", "cursor"]);
103
+ const healthy = results.every(result => result.status === "aligned" && result.credential === "present_unverified" && result.warnings.length === 0);
104
+ const result = { status: healthy ? "aligned" : "needs_attention", mode: "static", clients: results, next: "Restart the selected agent and call affitor_readiness. A credential_tracked warning requires rotating the key and removing it from Git tracking/history through your repository process. A credential_check_failed warning means Git tracking is unknown: fix Git access and retry. Static checks do not prove a live connection or integration readiness." };
105
+ if (getFlags(cmd).json)
106
+ process.stdout.write(JSON.stringify(result) + "\n");
107
+ else
108
+ process.stdout.write(JSON.stringify(result, null, 2) + "\n");
109
+ process.exitCode = healthy ? 0 : 1;
110
+ }
111
+ catch {
112
+ process.stdout.write(JSON.stringify({ status: "error", message: "Doctor could not check the selected client. Use claude_code, cursor or codex." }) + "\n");
113
+ process.exitCode = 1;
114
+ }
115
+ });
116
+ }
117
+ //# sourceMappingURL=agent.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,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,4VAA4V,EAAE,CAAC;YACzc,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI;gBAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;;gBACvE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;YAClE,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACrC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,+EAA+E,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;YAC3J,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -42,7 +42,7 @@ export async function runInit(opts, flags) {
42
42
  logger.error("Affitor already configured in this directory.\n" +
43
43
  " Use `npx affitor status` to check your program.\n" +
44
44
  " `init` creates a new program: it does not restore this one and does not replace its API key.\n" +
45
- " For a new key, ask a workspace owner of this program to open Affitor → Settings → API Key " +
45
+ " For a new key, ask a workspace owner of this program to open Affitor → Program settings → Developers → API keys " +
46
46
  "and click Regenerate, then replace the key this project uses.");
47
47
  if (flags.json) {
48
48
  logger.json({ error: "already_configured" });
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,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F,OAAO,GAAG,KAAK,eAAe,QAAQ,GAAG,CAAC;IAC5C,CAAC;IACD,OAAO,GAAG,KAAK,WAAW,CAAC;AAC7B,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,YAAY,CAAC,QAAiC;IAC5D,OAAO,QAAQ,CAAC,UAAU,KAAK,KAAK,IAAI,QAAQ,CAAC,UAAU,KAAK,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC;AACtG,CAAC"}
@@ -1,12 +1,51 @@
1
1
  import type { Command } from "commander";
2
+ import { AffitorAPI } from "../lib/api-client.js";
3
+ import { type Framework } from "../lib/stack-detect.js";
2
4
  import { type CLIFlags, type ReadinessResult, type TestChainStatus } from "../types.js";
3
5
  interface OnboardOpts {
4
6
  apiKey?: string;
5
7
  interactive?: boolean;
6
8
  yes?: boolean;
7
9
  }
10
+ /** A single machine-readable step in the --json summary. */
11
+ interface OnboardStep {
12
+ step: string;
13
+ status: "ok" | "skipped" | "manual" | "already" | "failed";
14
+ detail?: string;
15
+ }
8
16
  export declare function registerOnboardCommand(program: Command): void;
9
17
  export declare function runOnboard(opts: OnboardOpts, flags: CLIFlags): Promise<void>;
18
+ interface WireSaleArgs {
19
+ cwd: string;
20
+ framework: Framework;
21
+ provider: string;
22
+ interactive: boolean;
23
+ autoConfirm: boolean;
24
+ json: boolean;
25
+ /** A Stripe account is bound to the program in Affitor; undefined when it could not be read. */
26
+ stripeAccountBound?: boolean;
27
+ }
28
+ /**
29
+ * Does Affitor record this program's Stripe payments through Connect? Connect credits a sale when
30
+ * the program is bound to the event's Stripe account, whatever the connection status says
31
+ * (pending_verification still records), so `GET /v1/cli/status` answers with
32
+ * `stripe_account_bound`. Not `stripe_connected`: it is false while pending, and before CMS
33
+ * v3.16.91 it was true for any Server API program. undefined when the call fails or the field
34
+ * is missing, so the caller asks instead of guessing.
35
+ */
36
+ export declare function readStripeAccountBound(api: Pick<AffitorAPI, "getStatus">): Promise<true | undefined>;
37
+ /**
38
+ * The safety-critical part: locate the Stripe webhook, run the PURE
39
+ * `injectStripeTrackSale` transform, and:
40
+ * - `injected` → show the DIFF and confirm before writing.
41
+ * - `already` → no-op (idempotent).
42
+ * - `unrecognized` → PRINT the exact patch (snippet + inject_target + file:line).
43
+ * - no webhook → PRINT the full recipe.
44
+ * NEVER auto-edits when the structure isn't cleanly recognized.
45
+ */
46
+ export declare function wireServerSale(args: WireSaleArgs): Promise<OnboardStep>;
47
+ /** Find call tokens outside comments/literals; template interpolation is executable code. */
48
+ export declare function callsTrackSale(source: string): boolean;
10
49
  /**
11
50
  * The first failing gate (the blocker). The CMS readiness payload reports the
12
51
  * id of the first failing gate at the top-level `blocker` field, and the gate
@@ -1 +1 @@
1
- {"version":3,"file":"onboard.d.ts","sourceRoot":"","sources":["../../src/commands/onboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAezC,OAAO,EAAmB,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAEzG,UAAU,WAAW;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AASD,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,QAWtD;AAQD,wBAAsB,UAAU,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,iBA4GlE;AAqUD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,CAAC,EAAE,eAAe,GACjB;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAalD;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,eAAe,GAAG,SAAS,GAAG,MAAM,CAI3D"}
1
+ {"version":3,"file":"onboard.d.ts","s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