Skip to content

Commit 4da7ff4

Browse files
committed
revert: remove AGENTS.md changes (moved to PR #433)
1 parent 72a9686 commit 4da7ff4

File tree

1 file changed

+10
-124
lines changed

1 file changed

+10
-124
lines changed

AGENTS.md

Lines changed: 10 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -109,31 +109,13 @@ cli/
109109
│ │ ├── issue/ # list, view, explain, plan
110110
│ │ ├── org/ # list, view
111111
│ │ ├── project/ # list, view
112-
│ │ ├── span/ # list, view
113-
│ │ ├── trace/ # list, view, logs
114-
│ │ ├── log/ # list, view
115-
│ │ ├── trial/ # list, start
116-
│ │ ├── cli/ # fix, upgrade, feedback, setup
117112
│ │ ├── api.ts # Direct API access command
118113
│ │ └── help.ts # Help command
119114
│ ├── lib/ # Shared utilities
120-
│ │ ├── command.ts # buildCommand wrapper (telemetry + output)
121-
│ │ ├── api-client.ts # Barrel re-export for API modules
122-
│ │ ├── api/ # Domain API modules
123-
│ │ │ ├── infrastructure.ts # Shared helpers, types, raw requests
124-
│ │ │ ├── organizations.ts
125-
│ │ │ ├── projects.ts
126-
│ │ │ ├── issues.ts
127-
│ │ │ ├── events.ts
128-
│ │ │ ├── traces.ts # Trace + span listing
129-
│ │ │ ├── logs.ts
130-
│ │ │ ├── seer.ts
131-
│ │ │ └── trials.ts
115+
│ │ ├── api-client.ts # Sentry API client (ky-based)
132116
│ │ ├── region.ts # Multi-region resolution
133117
│ │ ├── telemetry.ts # Sentry SDK instrumentation
134118
│ │ ├── sentry-urls.ts # URL builders for Sentry
135-
│ │ ├── hex-id.ts # Hex ID validation (32-char + 16-char span)
136-
│ │ ├── trace-id.ts # Trace ID validation wrapper
137119
│ │ ├── db/ # SQLite database layer
138120
│ │ │ ├── instance.ts # Database singleton
139121
│ │ │ ├── schema.ts # Table definitions
@@ -143,7 +125,6 @@ cli/
143125
│ │ │ ├── user.ts # User info cache
144126
│ │ │ ├── regions.ts # Org→region URL cache
145127
│ │ │ ├── defaults.ts # Default org/project
146-
│ │ │ ├── pagination.ts # Cursor pagination storage
147128
│ │ │ ├── dsn-cache.ts # DSN resolution cache
148129
│ │ │ ├── project-cache.ts # Project data cache
149130
│ │ │ ├── project-root-cache.ts # Project root cache
@@ -173,12 +154,7 @@ cli/
173154
│ │ │ ├── json.ts # JSON output
174155
│ │ │ ├── output.ts # Output utilities
175156
│ │ │ ├── seer.ts # Seer AI response formatting
176-
│ │ │ ├── colors.ts # Terminal colors
177-
│ │ │ ├── markdown.ts # Markdown → ANSI renderer
178-
│ │ │ ├── trace.ts # Trace/span formatters
179-
│ │ │ ├── time-utils.ts # Shared time/duration utils
180-
│ │ │ ├── table.ts # Table rendering
181-
│ │ │ └── log.ts # Log entry formatting
157+
│ │ │ └── colors.ts # Terminal colors
182158
│ │ ├── oauth.ts # OAuth device flow
183159
│ │ ├── errors.ts # Error classes
184160
│ │ ├── resolve-target.ts # Org/project resolution
@@ -221,122 +197,34 @@ cli/
221197

222198
### CLI Commands (Stricli)
223199

224-
Commands use [Stricli](https://bloomberg.github.io/stricli/docs/getting-started/principles) wrapped by `src/lib/command.ts`.
200+
Commands use `@stricli/core`.
225201

226-
**CRITICAL**: Import `buildCommand` from `../../lib/command.js`, **NEVER** from `@stricli/core` directly — the wrapper adds telemetry, `--json`/`--fields` injection, and output rendering.
202+
**Stricli Documentation**: https://bloomberg.github.io/stricli/docs/getting-started/principles
227203

228204
Pattern:
229205

230206
```typescript
231-
import { buildCommand } from "../../lib/command.js";
207+
import { buildCommand } from "@stricli/core";
232208
import type { SentryContext } from "../../context.js";
233-
import { CommandOutput } from "../../lib/formatters/output.js";
234209

235210
export const myCommand = buildCommand({
236211
docs: {
237212
brief: "Short description",
238213
fullDescription: "Detailed description",
239214
},
240-
output: {
241-
human: formatMyData, // (data: T) => string
242-
jsonTransform: jsonTransformMyData, // optional: (data: T, fields?) => unknown
243-
jsonExclude: ["humanOnlyField"], // optional: strip keys from JSON
244-
},
245215
parameters: {
246216
flags: {
217+
json: { kind: "boolean", brief: "Output as JSON", default: false },
247218
limit: { kind: "parsed", parse: Number, brief: "Max items", default: 10 },
248219
},
249220
},
250-
async *func(this: SentryContext, flags) {
251-
const data = await fetchData();
252-
yield new CommandOutput(data);
253-
return { hint: "Tip: use --json for machine-readable output" };
221+
async func(this: SentryContext, flags) {
222+
const { process } = this;
223+
// Implementation - use process.stdout.write() for output
254224
},
255225
});
256226
```
257227

258-
**Key rules:**
259-
- Functions are `async *func()` generators — yield `new CommandOutput(data)`, return `{ hint }`.
260-
- `output.human` receives the same data object that gets serialized to JSON — no divergent-data paths.
261-
- The wrapper auto-injects `--json` and `--fields` flags. Do NOT add your own `json` flag.
262-
- Do NOT use `stdout.write()` or `if (flags.json)` branching — the wrapper handles it.
263-
264-
### Positional Arguments
265-
266-
Use `parseSlashSeparatedArg` from `src/lib/arg-parsing.ts` for the standard `[<org>/<project>/]<id>` pattern. Required identifiers (trace IDs, span IDs) should be **positional args**, not flags.
267-
268-
```typescript
269-
import { parseSlashSeparatedArg, parseOrgProjectArg } from "../../lib/arg-parsing.js";
270-
271-
// "my-org/my-project/abc123" → { id: "abc123", targetArg: "my-org/my-project" }
272-
const { id, targetArg } = parseSlashSeparatedArg(first, "Trace ID", USAGE_HINT);
273-
const parsed = parseOrgProjectArg(targetArg);
274-
// parsed.type: "auto-detect" | "explicit" | "project-search" | "org-all"
275-
```
276-
277-
Reference: `span/list.ts`, `trace/view.ts`, `event/view.ts`
278-
279-
### Markdown Rendering
280-
281-
All non-trivial human output must use the markdown rendering pipeline:
282-
283-
- Build markdown strings with helpers: `mdKvTable()`, `colorTag()`, `escapeMarkdownCell()`, `renderMarkdown()`
284-
- **NEVER** use raw `muted()` / chalk in output strings — use `colorTag("muted", text)` inside markdown
285-
- Tree-structured output (box-drawing characters) that can't go through `renderMarkdown()` should use the `plainSafeMuted` pattern: `isPlainOutput() ? text : muted(text)`
286-
- `isPlainOutput()` precedence: `SENTRY_PLAIN_OUTPUT` > `NO_COLOR` > `FORCE_COLOR` > `!isTTY`
287-
288-
Reference: `formatters/trace.ts` (`formatAncestorChain`), `formatters/human.ts` (`plainSafeMuted`)
289-
290-
### List Command Pagination
291-
292-
All list commands with API pagination MUST use the shared cursor infrastructure:
293-
294-
```typescript
295-
import { LIST_CURSOR_FLAG } from "../../lib/list-command.js";
296-
import {
297-
buildPaginationContextKey, resolveOrgCursor,
298-
setPaginationCursor, clearPaginationCursor,
299-
} from "../../lib/db/pagination.js";
300-
301-
export const PAGINATION_KEY = "my-entity-list";
302-
303-
// In buildCommand:
304-
flags: { cursor: LIST_CURSOR_FLAG },
305-
aliases: { c: "cursor" },
306-
307-
// In func():
308-
const contextKey = buildPaginationContextKey("entity", `${org}/${project}`, {
309-
sort: flags.sort, q: flags.query,
310-
});
311-
const cursor = resolveOrgCursor(flags.cursor, PAGINATION_KEY, contextKey);
312-
const { data, nextCursor } = await listEntities(org, project, { cursor, ... });
313-
if (nextCursor) setPaginationCursor(PAGINATION_KEY, contextKey, nextCursor);
314-
else clearPaginationCursor(PAGINATION_KEY, contextKey);
315-
```
316-
317-
Show `-c last` in the hint footer when more pages are available. Include `nextCursor` in the JSON envelope.
318-
319-
Reference template: `trace/list.ts`, `span/list.ts`
320-
321-
### ID Validation
322-
323-
Use shared validators from `src/lib/hex-id.ts`:
324-
- `validateHexId(value, label)` — 32-char hex IDs (trace IDs, log IDs). Auto-strips UUID dashes.
325-
- `validateSpanId(value)` — 16-char hex span IDs. Auto-strips dashes.
326-
- `validateTraceId(value)` — thin wrapper around `validateHexId` in `src/lib/trace-id.ts`.
327-
328-
All normalize to lowercase. Throw `ValidationError` on invalid input.
329-
330-
### Sort Convention
331-
332-
Use `"date"` for timestamp-based sort (not `"time"`). Export sort types from the API layer (e.g., `SpanSortValue` from `api/traces.ts`), import in commands. This matches `issue list`, `trace list`, and `span list`.
333-
334-
### SKILL.md
335-
336-
- Run `bun run generate:skill` after changing any command parameters, flags, or docs.
337-
- CI check `bun run check:skill` will fail if SKILL.md is stale.
338-
- Positional `placeholder` values must be descriptive: `"org/project/trace-id"` not `"args"`.
339-
340228
### Zod Schemas for Validation
341229

342230
All config and API types use Zod schemas:
@@ -432,7 +320,7 @@ await setAuthToken(token, expiresIn);
432320
433321
```typescript
434322
import { z } from "zod";
435-
import { buildCommand } from "../../lib/command.js";
323+
import { buildCommand } from "@stricli/core";
436324
import type { SentryContext } from "../../context.js";
437325
import { getAuthToken } from "../../lib/config.js";
438326
```
@@ -451,8 +339,6 @@ Key rules when writing overrides:
451339
- `resolveCursor()` must be called **inside** the `org-all` override closure, not before `dispatchOrgScopedList`, so that `--cursor` validation errors fire correctly for non-org-all modes.
452340
- `handleProjectSearch` errors must use `"Project"` as the `ContextError` resource, not `config.entityName`.
453341
454-
3. **Standalone list commands** (e.g., `span list`, `trace list`) that don't use org-scoped dispatch wire pagination directly in `func()`. See the "List Command Pagination" section above for the pattern.
455-
456342
## Commenting & Documentation (JSDoc-first)
457343
458344
### Default Rule

0 commit comments

Comments
 (0)