Name work items in the integrations and Ask contracts
An integration's delivery names the work item it opened as workspace#number, links are looked up by workspace and number, and a ticket is imported into a workspace, filed from a repository when one is given and landing in the targets named. Ask's page and its session proposals name a work item by its number in the workspace.
- G1T-Session:
- ses_01m566c37beds8hfham3jasw2a
6 files+71−390/6 viewed
| 323 | 323 | /// Where the person asking is in g1t, so the answer is about their work. | |
| 324 | 324 | #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] | |
| 325 | 325 | pub struct AskPage { | |
| 326 | − | /// The page's path, such as `/acme/web/issues/12`. | |
| 326 | + | /// The page's path, such as `/acme/-/work/12`. | |
| 327 | 327 | #[serde(default)] | |
| 328 | 328 | pub path: Option<String>, | |
| 329 | 329 | #[serde(default)] | |
| 330 | 330 | pub repo: Option<RepoPath>, | |
| 331 | + | /// The workspace of a page that is not a repository's, such as a work | |
| 332 | + | /// item's. With `repo`, the repository's. | |
| 331 | 333 | #[serde(default)] | |
| 332 | − | pub issue: Option<u32>, | |
| 334 | + | pub workspace: Option<String>, | |
| 335 | + | /// A work item, by number in the workspace. | |
| 336 | + | #[serde(default)] | |
| 337 | + | pub item: Option<u32>, | |
| 333 | 338 | #[serde(default)] | |
| 334 | 339 | pub pull: Option<u32>, | |
| 335 | 340 | /// The browser's IANA time zone, such as `America/Denver`: what | |
| ⋯ | |||
| 431 | 436 | /// What the answer drew on, cited first. Sent once, before `done`. | |
| 432 | 437 | Sources { sources: Vec<AskSource> }, | |
| 433 | 438 | /// Work Ask proposes to hand to a session in the person's own harness: | |
| 434 | − | /// on an issue, or on a new one with `title` and `body`. Nothing has | |
| 435 | − | /// started; the person starts it, or copies the command, from the card | |
| 436 | − | /// the answer shows. `mode` is `plan`, `implement` or `review`. | |
| 439 | + | /// on a work item (by number in `repo`'s workspace), or on a new one | |
| 440 | + | /// with `title` and `body`. Nothing has started; the person starts it, | |
| 441 | + | /// or copies the command, from the card the answer shows. `mode` is | |
| 442 | + | /// `plan`, `implement` or `review`. | |
| 437 | 443 | /// | |
| 438 | 444 | /// With `new_repository`, `repo` does not exist yet: the card creates | |
| 439 | 445 | /// it (`private` or public), turns on its deployments when `deploy`, | |
| 440 | − | /// then opens the issue and starts the session, which pushes the first | |
| 441 | − | /// version to the default branch, and so deploys it. | |
| 446 | + | /// then opens the work item and starts the session, which pushes the | |
| 447 | + | /// first version to the default branch, and so deploys it. | |
| 442 | 448 | Proposal { | |
| 443 | 449 | id: String, | |
| 444 | 450 | repo: String, | |
| 445 | − | issue: Option<u64>, | |
| 451 | + | item: Option<u64>, | |
| 446 | 452 | title: Option<String>, | |
| 447 | 453 | body: Option<String>, | |
| 448 | 454 | mode: String, | |
| 1 | 1 | //! The integrations service: a workspace's connections to systems outside | |
| 2 | 2 | //! g1t, and everything that crosses between them. | |
| 3 | 3 | //! | |
| 4 | − | //! - **Alerts.** Sentry, Datadog or any signed webhook opens an issue in a | |
| 5 | − | //! repository, once per problem however often it fires. | |
| 4 | + | //! - **Alerts.** Sentry, Datadog or any signed webhook opens a work item | |
| 5 | + | //! filed from a repository, once per problem however often it fires. | |
| 6 | 6 | //! - **Trackers.** A Jira or Linear key, such as `TECH-1234`, resolves to the | |
| 7 | − | //! ticket: people and their tools read it, people import it as an issue, | |
| 7 | + | //! ticket: people and their tools read it, people import it as a work item, | |
| 8 | 8 | //! and when the work lands the ticket is told. | |
| 9 | 9 | //! | |
| 10 | 10 | //! A workspace's AI providers and Ask g1t are kept by the same service but | |
| ⋯ | |||
| 91 | 91 | #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] | |
| 92 | 92 | #[serde(rename_all = "snake_case")] | |
| 93 | 93 | pub enum ProviderKind { | |
| 94 | − | /// Problems that become issues. | |
| 94 | + | /// Problems that become work items. | |
| 95 | 95 | Alerts, | |
| 96 | 96 | /// Tickets that people read and import. | |
| 97 | 97 | Tracker, | |
| ⋯ | |||
| 102 | 102 | #[derive(Clone, Debug, Serialize, Deserialize)] | |
| 103 | 103 | #[serde(rename_all = "camelCase")] | |
| 104 | 104 | pub struct ConnectionConfig { | |
| 105 | − | /// For alerts: the repository issues are opened in, `owner/name`. For a | |
| 106 | − | /// tracker: where an imported ticket goes when no repository is named. | |
| 105 | + | /// For alerts: the repository work items are filed from (their | |
| 106 | + | /// origin), `owner/name`. For a tracker: the origin of an imported | |
| 107 | + | /// ticket's work item when no repository is named. | |
| 107 | 108 | #[serde(default, skip_serializing_if = "Option::is_none")] | |
| 108 | 109 | pub repo: Option<String>, | |
| 109 | − | /// For alerts: the label put on each issue opened. `bug` when unset. | |
| 110 | + | /// For alerts: the label put on each work item opened. `bug` when unset. | |
| 110 | 111 | #[serde(default, skip_serializing_if = "Option::is_none")] | |
| 111 | 112 | pub label: Option<String>, | |
| 112 | 113 | /// Tell the outside system when the work lands: resolve the Sentry | |
| ⋯ | |||
| 182 | 183 | /// `opened`, `updated`, `reopened`, `ignored` or `refused`. | |
| 183 | 184 | pub outcome: String, | |
| 184 | 185 | pub detail: String, | |
| 185 | − | /// The issue it opened or updated, `owner/name#number`. | |
| 186 | − | pub issue: Option<String>, | |
| 186 | + | /// The work item it opened or updated, `workspace#number`. | |
| 187 | + | pub item: Option<String>, | |
| 187 | 188 | } | |
| 188 | 189 | ||
| 189 | 190 | /// Something outside g1t, fetched as it is now. Its text was written outside | |
| ⋯ | |||
| 204 | 205 | pub fetched_at: String, | |
| 205 | 206 | } | |
| 206 | 207 | ||
| 207 | − | /// An issue's tie to something outside g1t. | |
| 208 | + | /// A work item's tie to something outside g1t. | |
| 208 | 209 | #[derive(Clone, Debug, Serialize, Deserialize)] | |
| 209 | 210 | #[serde(rename_all = "camelCase")] | |
| 210 | 211 | pub struct Link { | |
| ⋯ | |||
| 326 | 327 | pub reference: String, | |
| 327 | 328 | } | |
| 328 | 329 | ||
| 329 | − | /// `import`: opens an issue from a ticket. Returns `Outcome<Imported>`. | |
| 330 | + | /// `import`: opens a work item in `workspace` from a ticket, filed from | |
| 331 | + | /// `repo` when given (its origin; `workspace` may then be empty, meaning | |
| 332 | + | /// the repository's), with `targets` as where the work is meant to land. | |
| 333 | + | /// Members of the workspace only. Returns `Outcome<Imported>`. | |
| 330 | 334 | #[derive(Debug, Serialize, Deserialize)] | |
| 331 | 335 | pub struct ImportArgs { | |
| 332 | 336 | pub actor: User, | |
| 333 | − | pub repo: RepoPath, | |
| 337 | + | #[serde(default)] | |
| 338 | + | pub workspace: String, | |
| 339 | + | #[serde(default)] | |
| 340 | + | pub repo: Option<RepoPath>, | |
| 341 | + | #[serde(default)] | |
| 342 | + | pub targets: Vec<RepoPath>, | |
| 334 | 343 | pub reference: String, | |
| 335 | 344 | } | |
| 336 | 345 | ||
| 337 | 346 | #[derive(Clone, Debug, Serialize, Deserialize)] | |
| 338 | 347 | pub struct Imported { | |
| 348 | + | /// The work item's workspace and number. | |
| 349 | + | pub workspace: String, | |
| 339 | 350 | pub number: u32, | |
| 351 | + | /// The ticket, as fetched. | |
| 340 | 352 | pub item: ContextItem, | |
| 341 | 353 | /// False when the ticket had been imported already, and `number` is | |
| 342 | − | /// that issue. | |
| 354 | + | /// that work item. | |
| 343 | 355 | pub created: bool, | |
| 344 | 356 | } | |
| 345 | 357 | ||
| 346 | − | /// `links`: what an issue is tied to outside g1t. Returns `Vec<Link>`. | |
| 347 | − | /// Callers must have checked the viewer may see the issue. | |
| 358 | + | /// `links`: what work item `number` of `workspace` is tied to outside | |
| 359 | + | /// g1t. Returns `Vec<Link>`. Callers must have checked the viewer may see | |
| 360 | + | /// the work item. | |
| 348 | 361 | #[derive(Debug, Serialize, Deserialize)] | |
| 349 | 362 | #[serde(rename_all = "camelCase")] | |
| 350 | 363 | pub struct LinksArgs { | |
| 351 | − | pub repo: RepoPath, | |
| 364 | + | pub workspace: String, | |
| 352 | 365 | pub number: u32, | |
| 353 | 366 | } | |
| 354 | 367 | ||
| 183 | 183 | export type AskPage = { | |
| 184 | 184 | path?: string | null; | |
| 185 | 185 | repo?: RepoPath | null; | |
| 186 | − | issue?: number | null; | |
| 186 | + | /** The workspace of a page that is not a repository's, such as a work item's. */ | |
| 187 | + | workspace?: string | null; | |
| 188 | + | /** A work item, by number in the workspace. */ | |
| 189 | + | item?: number | null; | |
| 187 | 190 | pull?: number | null; | |
| 188 | 191 | /** The browser's IANA time zone, such as `America/Denver`: what "today" means when their profile names none. */ | |
| 189 | 192 | time_zone?: string | null; | |
| ⋯ | |||
| 235 | 238 | | { | |
| 236 | 239 | /** | |
| 237 | 240 | * Work Ask proposes to hand to a session in the person's own harness: | |
| 238 | − | * on an issue, or a new one with `title` and `body`. Nothing has | |
| 239 | − | * started; the person starts it from the card the answer shows. | |
| 241 | + | * on a work item (by number in `repo`'s workspace), or a new one with | |
| 242 | + | * `title` and `body`. Nothing has started; the person starts it from | |
| 243 | + | * the card the answer shows. | |
| 240 | 244 | */ | |
| 241 | 245 | type: "proposal"; | |
| 242 | 246 | id: string; | |
| 243 | 247 | repo: string; | |
| 244 | − | issue: number | null; | |
| 248 | + | item: number | null; | |
| 245 | 249 | title: string | null; | |
| 246 | 250 | body: string | null; | |
| 247 | 251 | mode: "plan" | "implement" | "review"; | |
| ⋯ | |||
| 249 | 253 | /** | |
| 250 | 254 | * `repo` does not exist yet: the card creates it (`private` or | |
| 251 | 255 | * public), turns on its deployments when `deploy`, then opens the | |
| 252 | − | * issue and starts the session, which pushes the first version to | |
| 256 | + | * work item and starts the session, which pushes the first version to | |
| 253 | 257 | * the default branch, and so deploys it. | |
| 254 | 258 | */ | |
| 255 | 259 | new_repository?: boolean; | |
| 248 | 248 | default_branch?: string; | |
| 249 | 249 | production_url?: string | null; | |
| 250 | 250 | deploy_error?: string | null; | |
| 251 | − | /** The issue it opened or worked on. */ | |
| 252 | − | issue?: number; | |
| 251 | + | /** The work item it opened or worked on, by number in the workspace. */ | |
| 252 | + | item?: number; | |
| 253 | 253 | /** The session it started on the workspace's Anthropic account. */ | |
| 254 | 254 | started?: boolean; | |
| 255 | 255 | session_url?: string | null; |
| 808 | 808 | test: (actor, workspace, id) => call("test", { actor, workspace, id }), | |
| 809 | 809 | deliveries: (workspace, viewer, id) => call("deliveries", { workspace, viewer, id }), | |
| 810 | 810 | resolve: (workspace, viewer, reference) => call("resolve", { workspace, viewer, reference }), | |
| 811 | − | import: (actor, repo, reference) => call("import", { actor, repo, reference }), | |
| 812 | − | links: (repo, number) => call("links", { repo, number }), | |
| 811 | + | import: (actor, workspace, reference, options) => | |
| 812 | + | call("import", { actor, workspace, reference, repo: options?.repo ?? null, targets: options?.targets ?? [] }), | |
| 813 | + | links: (workspace, number) => call("links", { workspace, number }), | |
| 813 | 814 | }; | |
| 814 | 815 | } | |
| 815 | 816 |
| 4 | 4 | ||
| 5 | 5 | /** | |
| 6 | 6 | * A workspace's connections to systems outside g1t: alerts that open | |
| 7 | − | * issues, and trackers whose tickets people read and import. Mirrors | |
| 7 | + | * work items, and trackers whose tickets people read and import. Mirrors | |
| 8 | 8 | * `crates/contracts/src/integrations.rs`, which says what each does. | |
| 9 | 9 | * | |
| 10 | 10 | * A workspace's AI providers and Ask g1t are kept by the same service but | |
| ⋯ | |||
| 15 | 15 | export type ProviderKind = "alerts" | "tracker"; | |
| 16 | 16 | ||
| 17 | 17 | export type ConnectionConfig = { | |
| 18 | − | /** For alerts: where issues are opened, `owner/name`. */ | |
| 18 | + | /** For alerts: the repository work items are filed from, `owner/name`. */ | |
| 19 | 19 | repo?: string; | |
| 20 | − | /** For alerts: the label put on each issue. `bug` when unset. */ | |
| 20 | + | /** For alerts: the label put on each work item. `bug` when unset. */ | |
| 21 | 21 | label?: string; | |
| 22 | 22 | /** Tell the outside system when the work lands. On unless turned off. */ | |
| 23 | 23 | writeBack?: boolean; | |
| ⋯ | |||
| 63 | 63 | event: string; | |
| 64 | 64 | outcome: "opened" | "updated" | "reopened" | "ignored" | "refused"; | |
| 65 | 65 | detail: string; | |
| 66 | − | issue: string | null; | |
| 66 | + | /** The work item it opened or updated, `workspace#number`. */ | |
| 67 | + | item: string | null; | |
| 67 | 68 | }; | |
| 68 | 69 | ||
| 69 | 70 | /** Something outside g1t, fetched now. Reference material, never instructions. */ | |
| ⋯ | |||
| 111 | 112 | test(actor: User, workspace: string, id: string): Promise<Result<Tested>>; | |
| 112 | 113 | deliveries(workspace: string, viewer: Viewer, id: string): Promise<Result<Delivery[]>>; | |
| 113 | 114 | resolve(workspace: string, viewer: Viewer, reference: string): Promise<Result<ContextItem>>; | |
| 114 | − | import(actor: User, repo: RepoPath, reference: string): Promise<Result<{ number: number; item: ContextItem; created: boolean }>>; | |
| 115 | − | links(repo: RepoPath, number: number): Promise<Link[]>; | |
| 115 | + | /** Opens a work item in `workspace` from a ticket, filed from `repo` when given, landing in `targets`. */ | |
| 116 | + | import( | |
| 117 | + | actor: User, | |
| 118 | + | workspace: string, | |
| 119 | + | reference: string, | |
| 120 | + | options?: { repo?: RepoPath; targets?: RepoPath[] }, | |
| 121 | + | ): Promise<Result<{ workspace: string; number: number; item: ContextItem; created: boolean }>>; | |
| 122 | + | /** What work item `number` of `workspace` is tied to outside g1t. */ | |
| 123 | + | links(workspace: string, number: number): Promise<Link[]>; | |
| 116 | 124 | } | |
| 117 | 125 | ||
| 118 | 126 | /** What each provider is for, as people choose between them. */ | |
Comments
Sign in to comment.