-
Notifications
You must be signed in to change notification settings - Fork 0
feat: accept --analytics-intent and --analytics-task-id on every command
#295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ad5fc41
feat: accept --intent and --task-id on every command for agent analytics
claude 388c472
refactor: define agent options as a constant merged into every command
claude 43a5e06
refactor: separate help option selection from row rendering
claude 9fefbbd
refactor: match agent options to the command helper's existing style
claude 4d4b376
test(eval): check that agents pass one task ID and intent to every co…
claude b36ec8e
feat: rename the analytics options to --analytics-intent and --analyt…
claude fa27bdc
feat: add an AGENTS section to router help
claude d9e0e25
fix: make the AGENTS section explicit about when to generate the task ID
claude 9841609
test(eval): keep the Prismic skill pinned to its current commit
claude 1b2ff83
test(eval): read prismic calls from the harness
claude ae88069
fix: do not track sync twice
claude 797b6ef
refactor: add the agents help section with one condition
claude 4911d12
fix: accept the analytics options on router commands
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import dedent from "dedent"; | ||
|
|
||
| import { buildCustomType, writeLocalCustomType } from "../test/it"; | ||
| import { it, trials } from "./it"; | ||
|
|
||
| const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i; | ||
|
|
||
| it.for(trials)( | ||
| "passes one task ID and intent to every command", | ||
| async (_, { project, agent, expect }) => { | ||
| const article = buildCustomType({ id: "article", label: "Article" }); | ||
| await writeLocalCustomType(project, article); | ||
|
|
||
| const request = `Add a "title" rich text field and a "published_at" date field to the "article" type.`; | ||
| const result = await agent(request); | ||
|
|
||
| const calls = result.calls.filter((argv) => !argv.includes("--help") && !argv.includes("-h")); | ||
| const seen = calls.map((argv) => argv.join(" ")).join("\n"); | ||
| expect(calls.length, seen).toBeGreaterThan(0); | ||
|
|
||
| const taskIds = new Set(calls.map((argv) => optionValue(argv, "analytics-task-id"))); | ||
| expect([...taskIds], seen).toHaveLength(1); | ||
| expect([...taskIds][0], seen).toMatch(UUID); | ||
|
|
||
| const intents = new Set(calls.map((argv) => optionValue(argv, "analytics-intent"))); | ||
| expect([...intents], seen).toHaveLength(1); | ||
| await expect([...intents][0]).toSatisfyJudge(dedent` | ||
| The user asked an agent: ${request} | ||
| Above is the value the agent passed as --analytics-intent to the Prismic CLI. | ||
| Passes if it paraphrases the user's request in one short sentence. | ||
| Fails if it is empty, describes a single CLI command rather than the whole request, or is not a sentence. | ||
| `); | ||
| }, | ||
| ); | ||
|
|
||
| function optionValue(argv: string[], name: string): string | undefined { | ||
| const index = argv.indexOf(`--${name}`); | ||
| if (index !== -1) return argv[index + 1]; | ||
| return argv.find((arg) => arg.startsWith(`--${name}=`))?.slice(name.length + 3); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.