@clue-ai/cli 0.0.13 → 0.0.15

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,9 +7,11 @@ import {
7
7
  CLUE_CLI_RECOMMENDED_PREFIX,
8
8
  clueCliCommand,
9
9
  } from "./cli-invocation.mjs";
10
+ import { buildSetupDocumentationContract } from "./setup-documents.mjs";
10
11
 
11
12
  const SKILL_NAMES = [
12
13
  "clue-setup-orchestrator",
14
+ "clue-setup-reference",
13
15
  "clue-route-semantic-snapshot",
14
16
  "clue-semantic-gen",
15
17
  "clue-sdk-instrumentation",
@@ -17,7 +19,7 @@ const SKILL_NAMES = [
17
19
  "clue-local-verification",
18
20
  "clue-setup-report",
19
21
  ];
20
- const SETUP_SKILL_CONTENT_VERSION = "2026-05-10.lifecycle-placement-only.v2";
22
+ const SETUP_SKILL_CONTENT_VERSION = "2026-05-10.lifecycle-placement-only.v4";
21
23
 
22
24
  const TARGETS = new Set(["codex", "claude_code"]);
23
25
 
@@ -37,10 +39,21 @@ const normalizeTarget = (target) => {
37
39
  return normalized;
38
40
  };
39
41
 
40
- const skillBody = (name) => {
42
+ const skillBody = (name, { documentsUrl } = {}) => {
43
+ const documentationContract = buildSetupDocumentationContract({
44
+ documentsUrl,
45
+ });
46
+ const requiredDocIds = documentationContract.required_doc_ids.join(", ");
47
+ const frameworkDocIds = Object.entries(
48
+ documentationContract.framework_doc_ids_by_framework,
49
+ )
50
+ .map(([framework, docId]) => `${framework} -> ${docId}`)
51
+ .join(", ");
41
52
  const descriptions = {
42
53
  "clue-setup-orchestrator":
43
54
  "Use first when running Clue setup so lifecycle placement remains the only implementation workstream and read-only checks stay separate.",
55
+ "clue-setup-reference":
56
+ "Use before Clue setup implementation to read the public setup documents contract, select framework-specific docs, and record consulted document ids.",
44
57
  "clue-route-semantic-snapshot":
45
58
  "Use when checking backend route coverage and semantic snapshot readiness without hand-authoring generated snapshot files.",
46
59
  "clue-semantic-gen":
@@ -58,6 +71,8 @@ const skillBody = (name) => {
58
71
  const agentRoles = {
59
72
  "clue-setup-orchestrator":
60
73
  "Coordinator agent. Owns sequencing, agent assignment, gates, and blocker handling. It must not edit product code directly.",
74
+ "clue-setup-reference":
75
+ "Documentation reference agent. Owns reading the Clue setup docs contract, selecting relevant document ids, and reporting documentation blockers. It must not edit product code.",
61
76
  "clue-route-semantic-snapshot":
62
77
  "Semantic route readiness agent. Owns backend route inventory/readiness validation only. It must not author generated snapshot content or SDK code.",
63
78
  "clue-semantic-gen":
@@ -75,10 +90,18 @@ const skillBody = (name) => {
75
90
  const owns = {
76
91
  "clue-setup-orchestrator": [
77
92
  "read `.clue/setup-manifest.json` first",
93
+ "require `clue-setup-reference` before any SDK lifecycle placement",
78
94
  "assign exactly one implementation agent for SDK lifecycle placement",
79
95
  "assign multiple read-only monitoring agents",
80
96
  "stop on manifest blockers or P0/P1 findings",
81
97
  ],
98
+ "clue-setup-reference": [
99
+ "read `.clue/setup-manifest.json` documentation contract",
100
+ "open the public setup documents URL when tool access allows it",
101
+ "select required lifecycle docs and the detected framework doc",
102
+ "report documentation_access_blocked when docs cannot be opened",
103
+ "produce consulted_document_ids for downstream implementation and final report",
104
+ ],
82
105
  "clue-route-semantic-snapshot": [
83
106
  "backend route discovery readiness",
84
107
  "route coverage gaps and unsupported-framework blockers",
@@ -122,6 +145,12 @@ const skillBody = (name) => {
122
145
  "merge workstreams into one broad task",
123
146
  "continue after a blocker without reporting it",
124
147
  ],
148
+ "clue-setup-reference": [
149
+ "edit product code",
150
+ "infer setup behavior from memory when the docs contract is available",
151
+ "skip framework-specific docs when a framework doc id is available",
152
+ "claim docs were read without listing consulted_document_ids",
153
+ ],
125
154
  "clue-route-semantic-snapshot": [
126
155
  "create SDK lifecycle calls",
127
156
  "create or edit the CI workflow",
@@ -161,6 +190,12 @@ const skillBody = (name) => {
161
190
  "agent plan with execution agents, monitoring agents, file ownership, and gate order",
162
191
  "blocker list if setup cannot proceed",
163
192
  ],
193
+ "clue-setup-reference": [
194
+ "documentation readiness result: ready or blocked",
195
+ "documents_url used",
196
+ "consulted_document_ids or documentation_access_blocked reason",
197
+ "framework document id selected from the manifest",
198
+ ],
164
199
  "clue-route-semantic-snapshot": [
165
200
  "route readiness result: ready or blocked",
166
201
  "route coverage evidence and blocker details",
@@ -198,18 +233,32 @@ const skillBody = (name) => {
198
233
  "Use multiple monitoring agents for read-only checks, or named review passes if subagents are unavailable.",
199
234
  `The initial \`${clueCliCommand("setup --clue-api-key <key> --clue-api-base-url <url> --project-key <key> --environment <environment>")}\` command already performs repository discovery, semantic CI workflow generation, setup manifest generation, and writes service-specific environment guidance to \`.env.clue\` when backend routes can be detected.`,
200
235
  "Before implementation, read `.clue/setup-manifest.json` and treat it as the mechanical setup source of truth.",
236
+ "Read `.clue/setup-manifest.json` `documentation` and run `clue-setup-reference` before assigning SDK lifecycle placement.",
201
237
  "Read `.clue/setup-manifest.json` `cli_invocation` before running any Clue CLI subcommand.",
202
238
  `Before editing a customer repository, run \`${clueCliCommand("help --json")}\` and follow its setup_execution_contract.`,
203
239
  "Use the service keys and watch targets from `.clue/setup-manifest.json`; do not invent service keys.",
204
240
  "If `.clue/setup-manifest.json` has status `blocked`, stop and report its blockers instead of guessing.",
205
241
  "Treat semantic snapshot readiness and semantic CI as generated/static verification surfaces, not AI implementation workstreams.",
206
242
  "Do not implement or refresh semantic snapshot CI during lifecycle placement; report a blocker if generated semantic artifacts are missing or stale.",
243
+ "Before lifecycle placement, require `clue-setup-reference` to produce consulted_document_ids.",
207
244
  "Before lifecycle placement, read and apply `clue-sdk-instrumentation`.",
208
245
  "After lifecycle placement, run a monitoring check with `clue-setup-audit` before continuing.",
209
246
  "For final local verification, read and apply `clue-local-verification`.",
210
247
  "For the final report, read and apply `clue-setup-report`.",
211
248
  "Do not continue past P0/P1 monitoring findings until fixed or reported as blocked.",
212
249
  ],
250
+ "clue-setup-reference": [
251
+ "Read `.clue/setup-manifest.json` first.",
252
+ "Find the `documentation` object. If it is missing, run `npx -y @clue-ai/cli help --json` and use `setup_execution_contract.documentation_contract` as the fallback contract.",
253
+ "Use `documentation.documents_url` as the public docs page.",
254
+ "Open the docs page when the AI tool has browser or HTTP access. If it cannot be opened, continue only from the generated skill text and manifest doc ids, then report `documentation_access_blocked`.",
255
+ "Read all ids in `documentation.required_doc_ids` that apply to the detected repository.",
256
+ "For framework-specific implementation, select ids from `documentation.selected_framework_doc_ids` first. If empty, use `documentation.framework_doc_ids_by_framework` for the detected framework.",
257
+ "Minimum lifecycle docs before implementation: ai-setup-order, environment-and-secrets, browser-token-endpoint, clue-init, clue-identify, clue-set-account, clue-logout, setup-verification, forbidden-patterns.",
258
+ "For Next.js, read framework-nextjs. For React, Vite, Vue, or Angular browser apps, read framework-react-spa. For FastAPI, read framework-fastapi. For Django, read framework-django.",
259
+ "Return `consulted_document_ids` to the orchestrator and final report.",
260
+ "If a document contradicts `.clue/setup-manifest.json` or generated skills, stop and report a blocker instead of choosing behavior silently.",
261
+ ],
213
262
  "clue-route-semantic-snapshot": [
214
263
  "Use this skill as the source of truth for semantic snapshot readiness and route coverage verification.",
215
264
  "Do not hand-author semantic snapshot content files.",
@@ -251,6 +300,7 @@ const skillBody = (name) => {
251
300
  ],
252
301
  "clue-sdk-instrumentation": [
253
302
  "Use this skill as the source of truth for Clue SDK lifecycle implementation.",
303
+ "Before editing, confirm `clue-setup-reference` has produced consulted_document_ids for the relevant framework and lifecycle docs.",
254
304
  "The implementation scope is only ClueInit, ClueIdentify, ClueSetAccount, and ClueLogout placement in existing lifecycle boundaries.",
255
305
  "Keep SDK lifecycle implementation separate from semantic snapshot and CI workflow work.",
256
306
  "Do not create semantic snapshot content or semantic snapshot CI workflow files from this skill.",
@@ -266,15 +316,22 @@ const skillBody = (name) => {
266
316
  "Delete the temporary lifecycle plan file after applying it unless the user explicitly asks to keep it for review.",
267
317
  "Use environment variable names for Clue configuration values; do not paste project keys or API keys into code.",
268
318
  `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\`.`,
269
- "For browser code, use `CLUE_PROJECT_KEY`, `CLUE_ENVIRONMENT`, `CLUE_SERVICE_KEY`, and `CLUE_INGEST_ENDPOINT`. Let the target framework expose or inject those values safely without hard-coding a Next.js-only prefix.",
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.",
320
+ "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.",
321
+ "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.",
270
322
  "Never put `CLUE_API_KEY` in frontend code, frontend env files, browser bundles, or client-readable config.",
271
323
  "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.",
272
324
  "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`.",
273
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.",
328
+ "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
+ "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.",
274
330
  "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.",
275
- "`CLUE_API_BASE_URL` is for Clue CLI and semantic snapshot CI configuration, not backend SDK runtime configuration. Do not add it to application config unless existing non-Clue code already requires it.",
331
+ "`CLUE_API_BASE_URL` is not part of backend SDK initialization. Use it only when the application backend owns a browser-token proxy for a frontend service.",
332
+ "Do not add `@clue-ai/browser-sdk` or backend SDK dependencies with `*` or `latest`; use a concrete published version or package-manager-resolved semver range and update the repository lockfile when one exists.",
276
333
  "Use `CLUE_SERVICE_KEY` as the canonical local service identifier. Do not ask the user to manage a separate producer id; SDKs should send producer id as the service key for setup verification compatibility.",
277
- "For frontend code, pass `serviceKey` from `CLUE_SERVICE_KEY` to `ClueInit`. Do not require a separate producer id unless the repository already has one for compatibility.",
334
+ "For frontend code, pass `serviceKey` from the frontend service env name written by `.env.clue` to `ClueInit`; in Next.js browser/client code that name is `NEXT_PUBLIC_CLUE_SERVICE_KEY`.",
278
335
  "For Django code, use `clue-django-sdk` only after package-manager or registry verification confirms it is installable; if it is not published or cannot be verified, report a blocker instead of adding a guessed dependency or import.",
279
336
  "For other backend frameworks, use the matching Clue backend SDK if one exists; if no backend SDK exists, report a blocker instead of silently frontend-only setup.",
280
337
  "Do not send raw email, raw person names, tokens, workspace names, organization names, or tenant names as lifecycle traits unless the repository already has an explicit Clue privacy policy allowing them.",
@@ -290,6 +347,7 @@ const skillBody = (name) => {
290
347
  ],
291
348
  "clue-setup-audit": [
292
349
  "Act as a read-only monitoring agent, not the execution agent.",
350
+ "Confirm the final report draft includes consulted_document_ids and that lifecycle edits do not contradict the referenced docs.",
293
351
  "Check one completed workstream at a time and report P0/P1 issues before more implementation continues.",
294
352
  "Review changed files line by line.",
295
353
  "Verify semantic snapshot, semantic CI, and SDK lifecycle responsibilities did not bleed into each other.",
@@ -305,6 +363,8 @@ const skillBody = (name) => {
305
363
  "Reject ClueInit inside React component lifecycle hooks, page components, sidebars, login/register success callbacks, or any repeated user interaction path.",
306
364
  "Reject broad ClueTrack instrumentation and DOM clue tags.",
307
365
  "Reject ClueTrack instrumentation unless the user explicitly requested product event tracking.",
366
+ "Reject Next.js browser/client code that reads non-public `process.env.CLUE_*` variables.",
367
+ "Reject Clue SDK dependency entries that use `*` or `latest` instead of a concrete published version or package-manager-resolved semver range.",
308
368
  "Confirm no project key, API key, secret, or env value appears in diff or report.",
309
369
  "Confirm lifecycle insertions are minimal and reviewable.",
310
370
  "Reject whitespace-only edits, import sorting, formatter churn, or comment/style cleanup outside the exact Clue SDK wiring lines.",
@@ -312,6 +372,7 @@ const skillBody = (name) => {
312
372
  ],
313
373
  "clue-local-verification": [
314
374
  "Act as a read-only monitoring agent for local verification evidence.",
375
+ "Confirm documentation_access_blocked is reported if docs could not be opened, and do not treat that as event delivery verification.",
315
376
  "Verify each workstream independently before the final setup report.",
316
377
  "Confirm generated skill files exist.",
317
378
  "Confirm workflow files and SDK lifecycle imports/calls exist when those phases have run.",
@@ -335,6 +396,7 @@ const skillBody = (name) => {
335
396
  "clue-setup-report": [
336
397
  "Use this skill only after execution and monitoring passes are finished.",
337
398
  "Never claim `setup completed` from `setup-check --require-sdk-lifecycle` alone. That check is static and does not verify dependency installation, imports, app startup, or event delivery.",
399
+ "Include `consulted_document_ids` from `clue-setup-reference`; if docs could not be opened, include `documentation_access_blocked` with the reason.",
338
400
  "Completion requires all applicable evidence: SDK dependencies install successfully, SDK imports work in the target frontend/backend environments, the app starts, `setup-check --require-sdk-lifecycle` passes, and user-provided `setup-watch --local` or Clue setup screen evidence confirms expected event delivery.",
339
401
  "If any SDK package is unpublished, install/import checks were not run, app startup was not verified, or user-operated setup-watch/setup-screen evidence was not provided, the final status must be `blocked`, `partially complete`, or `user_verification_pending`; it must not be `complete`.",
340
402
  "For every completion claim, include the evidence source: command, exit status, output summary, file path, runtime URL, user-provided setup-watch result, or user-provided setup-screen result.",
@@ -343,7 +405,7 @@ const skillBody = (name) => {
343
405
  "List skills used for each workstream.",
344
406
  "List execution agent and monitoring agents, or named review passes if subagents were unavailable.",
345
407
  "List blockers with exact file or environment names when available.",
346
- "List required env names without values and group them by scope: service runtime env blocks versus GitHub Secrets/Variables. Do not report `CLUE_API_BASE_URL` as a backend SDK runtime env; it belongs to Clue CLI and semantic snapshot CI configuration.",
408
+ "List required env names without values and group them by scope: frontend runtime, backend runtime, GitHub Secrets, and GitHub Variables. Do not report `CLUE_API_BASE_URL` as a backend SDK init env; it belongs to Clue CLI/semantic CI and to backend browser-token proxy config only when a frontend service exists.",
347
409
  "List P0/P1 monitoring findings and fixes.",
348
410
  "State that commit and push were not performed.",
349
411
  ],
@@ -380,11 +442,16 @@ const skillBody = (name) => {
380
442
  `- Use \`${CLUE_CLI_RECOMMENDED_PREFIX} <command>\` for Clue CLI commands unless \`.clue/setup-manifest.json\` explicitly provides a different invocation.`,
381
443
  `- If checking Clue CLI availability, run \`${CLUE_CLI_RECOMMENDED_PREFIX} --version\` or \`${CLUE_CLI_RECOMMENDED_PREFIX} --help\` and report the exact fetch/runtime error if it fails.`,
382
444
  `- Before editing a customer repository, run \`${clueCliCommand("help --json")}\` and follow its setup_execution_contract.`,
445
+ `- Public Clue setup docs: \`${documentationContract.documents_url}\`.`,
446
+ `- Required setup doc ids: ${requiredDocIds}.`,
447
+ `- Framework setup doc mapping: ${frameworkDocIds}.`,
448
+ "- Before editing, read `.clue/setup-manifest.json` `documentation`, run `clue-setup-reference`, and carry `consulted_document_ids` into the final report.",
383
449
  `- Do not search for a global \`${CLUE_CLI_BINARY_NAME}\` binary or block on \`which ${CLUE_CLI_BINARY_NAME}\`; missing global binary is normal.`,
384
450
  "- The AI implementation task is only to decide where ClueInit, ClueIdentify, ClueSetAccount, and ClueLogout belong in existing code and apply the minimal SDK wiring for those calls.",
385
451
  "- 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.",
386
452
  "- 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.",
387
453
  "- 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.",
388
455
  "- Do not implement or refresh semantic snapshot CI during lifecycle placement; report a blocker if generated semantic artifacts are missing or stale.",
389
456
  `- Do not run \`${clueCliCommand("setup-watch --local")}\` automatically. setup-watch and the Clue setup screen are user-operated verification steps, not implementation-agent responsibility.`,
390
457
  "- The full setup must start with `clue-setup-orchestrator`.",
@@ -426,6 +493,7 @@ const askTarget = async ({
426
493
  export const installSetupSkills = async ({
427
494
  repoRoot,
428
495
  target,
496
+ documentsUrl,
429
497
  input,
430
498
  output,
431
499
  } = {}) => {
@@ -443,7 +511,7 @@ export const installSetupSkills = async ({
443
511
  const skillDir = join(skillRoot, skillName);
444
512
  const skillPath = join(skillDir, "SKILL.md");
445
513
  await mkdir(skillDir, { recursive: true });
446
- await writeFile(skillPath, skillBody(skillName), "utf8");
514
+ await writeFile(skillPath, skillBody(skillName, { documentsUrl }), "utf8");
447
515
  installed.push(skillPath);
448
516
  }
449
517