@clue-ai/cli 0.0.16 → 0.0.18

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.
@@ -7,6 +7,11 @@ import {
7
7
  CLUE_CLI_RECOMMENDED_PREFIX,
8
8
  clueCliCommand,
9
9
  } from "./cli-invocation.mjs";
10
+ import {
11
+ AI_SETUP_CONTRACT_VERSION,
12
+ API_CONNECTIVITY_CONTRACT,
13
+ setupDoctrineSkillLines,
14
+ } from "./setup-ai-contract.mjs";
10
15
  import { buildSetupDocumentationContract } from "./setup-documents.mjs";
11
16
 
12
17
  const SKILL_NAMES = [
@@ -19,7 +24,7 @@ const SKILL_NAMES = [
19
24
  "clue-local-verification",
20
25
  "clue-setup-report",
21
26
  ];
22
- const SETUP_SKILL_CONTENT_VERSION = "2026-05-10.lifecycle-placement-only.v4";
27
+ const SETUP_SKILL_CONTENT_VERSION = AI_SETUP_CONTRACT_VERSION;
23
28
 
24
29
  const TARGETS = new Set(["codex", "claude_code"]);
25
30
 
@@ -82,7 +87,7 @@ const skillBody = (name, { documentsUrl } = {}) => {
82
87
  "clue-setup-audit":
83
88
  "Read-only monitoring agent. Owns P0/P1 review for one completed workstream at a time. It must not edit files.",
84
89
  "clue-local-verification":
85
- "Read-only verification agent. Owns static setup checks, dependency/import/startup evidence, and user verification handoff. It must not edit files or run setup-watch automatically.",
90
+ "Read-only verification agent. Owns static setup checks, setup-doctor API connectivity preflight, dependency/import/startup evidence, and user verification handoff. It must not edit files or run setup-watch automatically.",
86
91
  "clue-setup-report":
87
92
  "Final reporting agent. Owns concise completion evidence only after execution and monitoring gates pass.",
88
93
  };
@@ -128,6 +133,7 @@ const skillBody = (name, { documentsUrl } = {}) => {
128
133
  ],
129
134
  "clue-local-verification": [
130
135
  "`setup-check` evidence",
136
+ "`setup-doctor --local` API connectivity preflight when local services and required env are available",
131
137
  "user-operated `setup-watch --local` handoff readiness",
132
138
  "local URL confirmation without assuming ports",
133
139
  ],
@@ -316,15 +322,21 @@ const skillBody = (name, { documentsUrl } = {}) => {
316
322
  "Delete the temporary lifecycle plan file after applying it unless the user explicitly asks to keep it for review.",
317
323
  "Use environment variable names for Clue configuration values; do not paste project keys or API keys into code.",
318
324
  `For local env files, use the service-specific env blocks written to \`.env.clue\` by \`${clueCliCommand("setup")}\`; do not ask the user to guess \`CLUE_SERVICE_KEY\`.`,
319
- "For Next.js browser/client code, use only `NEXT_PUBLIC_CLUE_PROJECT_KEY`, `NEXT_PUBLIC_CLUE_ENVIRONMENT`, `NEXT_PUBLIC_CLUE_SERVICE_KEY`, and `NEXT_PUBLIC_CLUE_INGEST_ENDPOINT` from the frontend `.env.local` block.",
325
+ "For Next.js browser/client code, use only `NEXT_PUBLIC_CLUE_PROJECT_KEY`, `NEXT_PUBLIC_CLUE_ENVIRONMENT`, `NEXT_PUBLIC_CLUE_SERVICE_KEY`, `NEXT_PUBLIC_CLUE_INGEST_ENDPOINT`, and `NEXT_PUBLIC_CLUE_BROWSER_TOKEN_ENDPOINT` from the frontend `.env.local` block.",
320
326
  "Do not read `process.env.CLUE_PROJECT_KEY`, `process.env.CLUE_ENVIRONMENT`, `process.env.CLUE_SERVICE_KEY`, or `process.env.CLUE_INGEST_ENDPOINT` in Next.js browser/client code, and do not add non-public `CLUE_*` fallbacks there.",
327
+ "Frontend SDK adapter code is contract-owned Clue setup wiring. The AI may choose the existing import/mount point, but must not invent token URL, env, or initialization semantics.",
328
+ "For Next.js frontend adapters, read the full customer-backend browser-token proxy URL from `NEXT_PUBLIC_CLUE_BROWSER_TOKEN_ENDPOINT`. Do not derive it from `NEXT_PUBLIC_API_URL`, generic app API env names, detected backend ports, or relative frontend-origin paths.",
329
+ "Do not mix stale browser-token paths such as `/api/clue/browser-token`, `/clue/browser-tokens`, or `/browser-tokens` with the canonical `/api/v1/clue/browser-tokens` path.",
330
+ "Do not call `ClueInit` with empty-string fallbacks for required `NEXT_PUBLIC_CLUE_*` values. If required Clue env is absent, skip initialization and report the missing env names.",
331
+ "If a singleton guard is used, do not set `initialized = true` before `ClueInit` has actually been called with required config present.",
321
332
  "For non-Next.js browser code, use the exact frontend env names written in `.env.clue` for that service instead of inventing a framework-specific prefix.",
322
333
  "Never put `CLUE_API_KEY` in frontend code, frontend env files, browser bundles, or client-readable config.",
323
334
  "When browser SDK ingest is configured, implement a backend-owned browser token endpoint that reads server-side `CLUE_API_KEY` and requests `POST /api/v1/ingest/browser-tokens` from Clue.",
324
335
  "Configure frontend `ClueInit` with `browserTokenProvider` that calls the local backend token endpoint and returns the token string.",
325
- "The local backend token endpoint is part of the customer app, not the Clue API. It may be named with the customer app's route convention, but it must call Clue server-side at `/api/v1/ingest/browser-tokens`.",
326
- "The frontend `browserTokenProvider` must send the same service key used by `ClueInit` to the customer backend token endpoint. For Next.js this value comes from `NEXT_PUBLIC_CLUE_SERVICE_KEY`.",
327
- "The browser token request must include project key, environment, service key, and the current browser origin; the backend must attach `x-clue-api-key` server-side when calling Clue.",
336
+ "The local backend token endpoint is part of the customer app, not the Clue API. Place it under a Clue-reserved local route such as `/api/v1/clue/browser-tokens`; do not use a generic path such as `/browser-tokens` that could be confused with product behavior. It must call Clue server-side at `/api/v1/ingest/browser-tokens`.",
337
+ "The frontend `browserTokenProvider` must call `NEXT_PUBLIC_CLUE_BROWSER_TOKEN_ENDPOINT` and send the same service key used by `ClueInit` to the customer backend token endpoint. For Next.js this value comes from `NEXT_PUBLIC_CLUE_SERVICE_KEY`.",
338
+ "The browser token request must include the frontend service key used by `ClueInit`. Project key and environment may be included only as public consistency hints; the backend must use server configuration or validate them against server configuration before calling Clue.",
339
+ "The backend browser token proxy must derive origin from trusted request headers or server request metadata. Do not forward `origin`, `projectKey`, or `environment` from JSON/body payload fields under server `CLUE_API_KEY`.",
328
340
  "For browser token proxy code, the service key sent to Clue must be the frontend `ClueInit` serviceKey from the browser request, not the backend service's `CLUE_SERVICE_KEY`.",
329
341
  "If a backend-owned browser token endpoint is implemented, read `CLUE_API_BASE_URL` from the backend env block and normalize it so values with or without a trailing `/api/v1` do not produce duplicate paths.",
330
342
  "For FastAPI code, add `clue-fastapi-sdk` to the backend dependency file when missing, import `clue_init_fastapi` plus `ClueIdentify`, `ClueSetAccount`, and `ClueLogout` where needed, and use `CLUE_PROJECT_KEY`, `CLUE_ENVIRONMENT`, `CLUE_API_KEY`, and `CLUE_INGEST_ENDPOINT` from the backend env block.",
@@ -359,12 +371,18 @@ const skillBody = (name, { documentsUrl } = {}) => {
359
371
  "Reject Django SDK setup when `clue-django-sdk` installability has not been verified.",
360
372
  "Reject backend setup when backend routes exist but no backend Clue SDK dependency/import/init was added.",
361
373
  "Reject awaited lifecycle calls that can block host service behavior.",
374
+ "Reject browser token proxy code that forwards origin, projectKey, or environment from request JSON/body under server `CLUE_API_KEY`.",
375
+ "Reject frontend browser token providers that derive the Clue proxy URL from `NEXT_PUBLIC_API_URL`, generic app API env names, detected backend ports, or non-Clue routing assumptions.",
376
+ "Reject frontend adapters that mix stale browser-token paths such as `/api/clue/browser-token`, `/clue/browser-tokens`, or `/browser-tokens` with the canonical `/api/v1/clue/browser-tokens` path.",
377
+ "Reject frontend adapters that set `initialized = true` before calling `ClueInit`, or pass empty-string fallbacks for required `NEXT_PUBLIC_CLUE_*` values into `ClueInit`.",
378
+ "Audit the setup diff against the Clue setup contract even when the code was written by another agent or an earlier pass. Ownership of authorship is irrelevant to approval.",
362
379
  "Reject setup that covers only one login path when multiple login success paths are clearly present.",
363
380
  "Reject ClueInit inside React component lifecycle hooks, page components, sidebars, login/register success callbacks, or any repeated user interaction path.",
364
381
  "Reject broad ClueTrack instrumentation and DOM clue tags.",
365
382
  "Reject ClueTrack instrumentation unless the user explicitly requested product event tracking.",
366
383
  "Reject Next.js browser/client code that reads non-public `process.env.CLUE_*` variables.",
367
384
  "Reject Clue SDK dependency entries that use `*` or `latest` instead of a concrete published version or package-manager-resolved semver range.",
385
+ "Reject Next.js browser token providers that do not read `NEXT_PUBLIC_CLUE_BROWSER_TOKEN_ENDPOINT`.",
368
386
  "Confirm no project key, API key, secret, or env value appears in diff or report.",
369
387
  "Confirm lifecycle insertions are minimal and reviewable.",
370
388
  "Reject whitespace-only edits, import sorting, formatter churn, or comment/style cleanup outside the exact Clue SDK wiring lines.",
@@ -384,6 +402,7 @@ const skillBody = (name, { documentsUrl } = {}) => {
384
402
  "Confirm the semantic workflow does not send GitHub actor, triggering_actor, sender, repository owner, repository name, or default branch to Clue.",
385
403
  "Confirm `.clue/semantic-request.runtime.json` is not created, committed, or staged.",
386
404
  `Run \`${clueCliCommand("setup-check --framework <framework> --backend-root-path <path> --repo . --target <codex|claude_code> --require-sdk-lifecycle")}\` when possible.`,
405
+ `Run \`${clueCliCommand("setup-doctor --local")}\` when local frontend/backend services are running and required env values are available. Report skipped_setup_doctor with the missing service URL or env name when it cannot run.`,
387
406
  `Do not run \`${clueCliCommand("setup-watch --local")}\` automatically. setup-watch requires the user to operate real local frontend/backend services and login/logout/account flows.`,
388
407
  "If the user has not provided setup-watch or setup-screen evidence, report event delivery verification as `user_verification_pending` and do not state `setup completed`.",
389
408
  "Local static verification passed does not mean setup complete unless dependency install, SDK imports, app startup, and user-provided setup-watch or setup-screen event delivery were all verified.",
@@ -436,6 +455,7 @@ const skillBody = (name, { documentsUrl } = {}) => {
436
455
  "",
437
456
  "# Shared Rules",
438
457
  "",
458
+ ...setupDoctrineSkillLines(),
439
459
  "- For full Clue setup, use one SDK lifecycle placement implementation agent and multiple monitoring agents for read-only checks.",
440
460
  `- Clue CLI public npm package: \`${CLUE_CLI_PACKAGE_NAME}\`.`,
441
461
  `- Clue CLI binary name exposed by that package: \`${CLUE_CLI_BINARY_NAME}\`; a global \`${CLUE_CLI_BINARY_NAME}\` install is not required.`,
@@ -451,7 +471,11 @@ const skillBody = (name, { documentsUrl } = {}) => {
451
471
  "- Only exact changes required to place ClueInit, ClueIdentify, ClueSetAccount, and ClueLogout are allowed. Do not perform ClueTrack instrumentation unless the user explicitly requested product event tracking.",
452
472
  "- Do not perform unrelated refactors, renames, file moves, formatting churn, broad cleanup, business logic rewrites, auth/session rewrites beyond minimal Clue hook insertion, UI changes unrelated to Clue setup, or unrelated dependency upgrades.",
453
473
  "- Do not run broad formatters or make whitespace-only cleanup. Keep formatting changes limited to lines directly touched for Clue SDK wiring.",
454
- "- A customer backend browser-token endpoint is only a proxy for browser SDK token issuance. It is not the Clue API itself; the backend must call Clue server-side at `/api/v1/ingest/browser-tokens` with the frontend `ClueInit` service key supplied by the browser token provider.",
474
+ "- A customer backend browser-token endpoint is only a proxy for browser SDK token issuance. It must live under a Clue-reserved local route such as `/api/v1/clue/browser-tokens`, not a generic product-looking path such as `/browser-tokens`. It is not the Clue API itself; the backend must call Clue server-side at `/api/v1/ingest/browser-tokens` with the frontend `ClueInit` service key supplied by the browser token provider and server-owned project/environment values.",
475
+ `- Setup API connectivity has four distinct hops: ${Object.entries(API_CONNECTIVITY_CONTRACT.hops)
476
+ .map(([name, hop]) => `${name}=${hop.method} ${hop.path}`)
477
+ .join(", ")}.`,
478
+ `- Run \`${clueCliCommand("setup-doctor --local")}\` when local services and required env are available. This checks API connectivity only; it does not replace user-operated setup-watch.`,
455
479
  "- Do not implement or refresh semantic snapshot CI during lifecycle placement; report a blocker if generated semantic artifacts are missing or stale.",
456
480
  `- Do not run \`${clueCliCommand("setup-watch --local")}\` automatically. setup-watch and the Clue setup screen are user-operated verification steps, not implementation-agent responsibility.`,
457
481
  "- The full setup must start with `clue-setup-orchestrator`.",