terse-cli 0.1.45 → 0.1.47

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.
Files changed (139) hide show
  1. package/dist/api.d.ts +0 -2
  2. package/dist/api.d.ts.map +1 -1
  3. package/dist/api.js +2 -2
  4. package/dist/api.js.map +1 -1
  5. package/dist/cliError.d.ts +2 -3
  6. package/dist/cliError.d.ts.map +1 -1
  7. package/dist/cliError.js +2 -2
  8. package/dist/cliError.js.map +1 -1
  9. package/dist/commands/auth.d.ts +0 -5
  10. package/dist/commands/auth.d.ts.map +1 -1
  11. package/dist/commands/auth.js +7 -6
  12. package/dist/commands/auth.js.map +1 -1
  13. package/dist/commands/deployTheme.d.ts +28 -0
  14. package/dist/commands/deployTheme.d.ts.map +1 -0
  15. package/dist/commands/deployTheme.js +68 -0
  16. package/dist/commands/deployTheme.js.map +1 -0
  17. package/dist/commands/dev.d.ts +3 -0
  18. package/dist/commands/dev.d.ts.map +1 -0
  19. package/dist/commands/dev.js +47 -0
  20. package/dist/commands/dev.js.map +1 -0
  21. package/dist/commands/serve.d.ts +1 -0
  22. package/dist/commands/serve.d.ts.map +1 -0
  23. package/dist/commands/serve.js +2 -0
  24. package/dist/commands/serve.js.map +1 -0
  25. package/dist/commands/terseCliTheme.d.ts +28 -0
  26. package/dist/commands/terseCliTheme.d.ts.map +1 -0
  27. package/dist/commands/terseCliTheme.js +68 -0
  28. package/dist/commands/terseCliTheme.js.map +1 -0
  29. package/dist/commands/test.d.ts +0 -35
  30. package/dist/commands/test.d.ts.map +1 -1
  31. package/dist/commands/test.js +1 -1
  32. package/dist/commands/test.js.map +1 -1
  33. package/dist/env.d.ts +0 -2
  34. package/dist/env.d.ts.map +1 -1
  35. package/dist/env.js +1 -1
  36. package/dist/env.js.map +1 -1
  37. package/dist/nonInteractive.d.ts +4 -2
  38. package/dist/nonInteractive.d.ts.map +1 -1
  39. package/dist/nonInteractive.js +5 -2
  40. package/dist/nonInteractive.js.map +1 -1
  41. package/dist/perf.d.ts +9 -0
  42. package/dist/perf.d.ts.map +1 -0
  43. package/dist/perf.js +59 -0
  44. package/dist/perf.js.map +1 -0
  45. package/dist/projectConfig.d.ts +0 -1
  46. package/dist/projectConfig.d.ts.map +1 -1
  47. package/dist/projectConfig.js +1 -1
  48. package/dist/projectConfig.js.map +1 -1
  49. package/dist/providers/LanguageProvider.d.ts +1 -1
  50. package/dist/providers/LanguageProvider.d.ts.map +1 -1
  51. package/dist/providers/codegen.test.d.ts +2 -0
  52. package/dist/providers/codegen.test.d.ts.map +1 -0
  53. package/dist/providers/codegen.test.js +45 -0
  54. package/dist/providers/codegen.test.js.map +1 -0
  55. package/dist/providers/codegenTypes.d.ts +10 -9
  56. package/dist/providers/codegenTypes.d.ts.map +1 -1
  57. package/dist/providers/fetchSdkVersion.d.ts +1 -3
  58. package/dist/providers/fetchSdkVersion.d.ts.map +1 -1
  59. package/dist/providers/fetchSdkVersion.js +2 -2
  60. package/dist/providers/fetchSdkVersion.js.map +1 -1
  61. package/dist/providers/python/PythonProvider.js +1 -0
  62. package/dist/providers/python/PythonProvider.js.map +1 -1
  63. package/dist/providers/python/PythonProvider.test.d.ts +2 -0
  64. package/dist/providers/python/PythonProvider.test.d.ts.map +1 -0
  65. package/dist/providers/python/PythonProvider.test.js +169 -0
  66. package/dist/providers/python/PythonProvider.test.js.map +1 -0
  67. package/dist/providers/resolveProvider.d.ts +0 -1
  68. package/dist/providers/resolveProvider.d.ts.map +1 -1
  69. package/dist/providers/resolveProvider.js +4 -20
  70. package/dist/providers/resolveProvider.js.map +1 -1
  71. package/dist/providers/shared/sessionStream.d.ts +0 -4
  72. package/dist/providers/shared/sessionStream.d.ts.map +1 -1
  73. package/dist/providers/shared/sessionStream.js +1 -1
  74. package/dist/providers/shared/sessionStream.js.map +1 -1
  75. package/dist/providers/shared/shellUtils.d.ts +0 -11
  76. package/dist/providers/shared/shellUtils.d.ts.map +1 -1
  77. package/dist/providers/shared/shellUtils.js +0 -44
  78. package/dist/providers/shared/shellUtils.js.map +1 -1
  79. package/dist/providers/templateUtils.d.ts +0 -2
  80. package/dist/providers/templateUtils.d.ts.map +1 -1
  81. package/dist/providers/templateUtils.js +2 -2
  82. package/dist/providers/templateUtils.js.map +1 -1
  83. package/dist/providers/typescript/TypeScriptProvider.d.ts +2 -1
  84. package/dist/providers/typescript/TypeScriptProvider.d.ts.map +1 -1
  85. package/dist/providers/typescript/TypeScriptProvider.js +1 -1
  86. package/dist/providers/typescript/TypeScriptProvider.js.map +1 -1
  87. package/dist/providers/typescript/prepareCodegenData.d.ts +20 -23
  88. package/dist/providers/typescript/prepareCodegenData.d.ts.map +1 -1
  89. package/dist/providers/typescript/prepareCodegenData.js +4 -4
  90. package/dist/providers/typescript/prepareCodegenData.js.map +1 -1
  91. package/dist/providers/typescript/prepareCodegenData.test.d.ts +2 -0
  92. package/dist/providers/typescript/prepareCodegenData.test.d.ts.map +1 -0
  93. package/dist/providers/typescript/prepareCodegenData.test.js +54 -0
  94. package/dist/providers/typescript/prepareCodegenData.test.js.map +1 -0
  95. package/dist/run.d.ts.map +1 -1
  96. package/dist/run.js +36 -12
  97. package/dist/run.js.map +1 -1
  98. package/dist/sampleEventId.d.ts +0 -4
  99. package/dist/sampleEventId.d.ts.map +1 -1
  100. package/dist/sampleEventId.js +0 -4
  101. package/dist/sampleEventId.js.map +1 -1
  102. package/dist/shared/ToolDisplayUtils.js +1 -1
  103. package/dist/shared/ToolDisplayUtils.js.map +1 -1
  104. package/package.json +3 -3
  105. package/dist/jsonOutput.d.ts +0 -19
  106. package/dist/jsonOutput.d.ts.map +0 -1
  107. package/dist/jsonOutput.js +0 -25
  108. package/dist/jsonOutput.js.map +0 -1
  109. package/dist/replay.d.ts +0 -3
  110. package/dist/replay.d.ts.map +0 -1
  111. package/dist/replay.js +0 -20
  112. package/dist/replay.js.map +0 -1
  113. package/dist/urls.d.ts +0 -3
  114. package/dist/urls.d.ts.map +0 -1
  115. package/dist/urls.js +0 -27
  116. package/dist/urls.js.map +0 -1
  117. package/templates/python/codegen/generated.hbs +0 -12
  118. package/templates/python/codegen/partials/attio-list-objects-method.hbs +0 -8
  119. package/templates/python/codegen/partials/attio-object-types.hbs +0 -23
  120. package/templates/python/codegen/partials/attio-query-records-method.hbs +0 -45
  121. package/templates/python/codegen/partials/attio-section.hbs +0 -110
  122. package/templates/python/codegen/partials/attio-upsert-record-method.hbs +0 -51
  123. package/templates/python/codegen/partials/deterministic-tools-section.hbs +0 -308
  124. package/templates/python/codegen/partials/file-header.hbs +0 -32
  125. package/templates/python/codegen/partials/github-section.hbs +0 -149
  126. package/templates/python/codegen/partials/gmail-section.hbs +0 -30
  127. package/templates/python/codegen/partials/linear-section.hbs +0 -229
  128. package/templates/python/codegen/partials/schedule-section.hbs +0 -15
  129. package/templates/python/codegen/partials/slack-section.hbs +0 -266
  130. package/templates/python/codegen/partials/snowflake-section.hbs +0 -26
  131. package/templates/python/codegen/partials/tool-name-types.hbs +0 -18
  132. package/templates/python/codegen/partials/webhook-section.hbs +0 -15
  133. package/templates/python/codegen/partials/workos-section.hbs +0 -149
  134. package/templates/python/init/.python-version.hbs +0 -1
  135. package/templates/python/init/README.md.hbs +0 -68
  136. package/templates/python/init/env.example.hbs +0 -1
  137. package/templates/python/init/gitignore.hbs +0 -3
  138. package/templates/python/init/pyproject.toml.hbs +0 -16
  139. package/templates/python/init/src/main.py.hbs +0 -23
@@ -1,308 +0,0 @@
1
-
2
-
3
- # === Deterministic tools ===
4
-
5
- {{#if hasAttioTools}}
6
- _ATTIO_FILTER_ATTRS_BY_OBJECT: dict[str, frozenset[str]] = {
7
- {{#each attio.objects}}
8
- {{#if hasAttributes}}
9
- {{{apiSlugRepr}}}: {{{attrSlugsFrozensetRepr}}},
10
- {{/if}}
11
- {{/each}}
12
- }
13
-
14
-
15
- def _attio_invalid_filter_error(obj_slug: str, attribute: str | None = None) -> ValueError:
16
- message = f"Invalid Attio filter for object {obj_slug!r}"
17
- if attribute is not None:
18
- message += f" on attribute {attribute!r}"
19
- message += ": list shorthand is not supported."
20
- if attribute == 'domains':
21
- message += ' Use scalar shorthand "useterse.ai" or explicit Attio syntax {"domain": {"$eq": "useterse.ai"}}.'
22
- else:
23
- message += " Use a scalar shorthand or explicit Attio operator/object syntax instead."
24
- return ValueError(message)
25
-
26
-
27
- def _validate_attio_filter_node(
28
- obj_slug: str,
29
- value: object,
30
- *,
31
- attr_slugs: frozenset[str],
32
- current_attribute: str | None = None,
33
- ) -> None:
34
- if isinstance(value, dict):
35
- for raw_key, child in value.items():
36
- if not isinstance(raw_key, str):
37
- raise ValueError(f"Invalid Attio filter for object {obj_slug!r}: filter keys must be strings.")
38
- key = raw_key
39
- if key in ('$and', '$or'):
40
- if not isinstance(child, list):
41
- raise ValueError(f"Invalid Attio filter for object {obj_slug!r}: {key} must be a list.")
42
- for item in child:
43
- if not isinstance(item, dict):
44
- raise ValueError(f"Invalid Attio filter for object {obj_slug!r}: {key} entries must be objects.")
45
- _validate_attio_filter_node(obj_slug, item, attr_slugs=attr_slugs)
46
- continue
47
- if key == '$not':
48
- if not isinstance(child, dict):
49
- raise ValueError(f"Invalid Attio filter for object {obj_slug!r}: $not must be an object.")
50
- _validate_attio_filter_node(obj_slug, child, attr_slugs=attr_slugs)
51
- continue
52
- if key == '$in':
53
- if not isinstance(child, list):
54
- raise ValueError(f"Invalid Attio filter for object {obj_slug!r}: $in must be a list.")
55
- continue
56
- if key == 'path':
57
- if not isinstance(child, list):
58
- raise ValueError(f"Invalid Attio filter for object {obj_slug!r}: path must be a list.")
59
- continue
60
- if key == 'constraints':
61
- if not isinstance(child, dict):
62
- raise ValueError(f"Invalid Attio filter for object {obj_slug!r}: constraints must be an object.")
63
- _validate_attio_filter_node(
64
- obj_slug,
65
- child,
66
- attr_slugs=attr_slugs,
67
- current_attribute=current_attribute,
68
- )
69
- continue
70
-
71
- attribute: str | None = key if key in attr_slugs else current_attribute
72
- if isinstance(child, list):
73
- raise _attio_invalid_filter_error(obj_slug, attribute)
74
- _validate_attio_filter_node(
75
- obj_slug,
76
- child,
77
- attr_slugs=attr_slugs,
78
- current_attribute=attribute,
79
- )
80
-
81
-
82
- def _serialize_attio_filter(obj_slug: str, value: object | None) -> str | None:
83
- if value is None:
84
- return None
85
-
86
- parsed = value
87
- if isinstance(value, str):
88
- try:
89
- parsed = json.loads(value)
90
- except json.JSONDecodeError as exc:
91
- raise ValueError(f"Attio filters for object {obj_slug!r} must be valid JSON objects.") from exc
92
-
93
- if not isinstance(parsed, dict):
94
- raise ValueError(f"Attio filters for object {obj_slug!r} must be objects.")
95
-
96
- _validate_attio_filter_node(
97
- obj_slug,
98
- parsed,
99
- attr_slugs=_ATTIO_FILTER_ATTRS_BY_OBJECT.get(obj_slug, frozenset()),
100
- )
101
- return json.dumps(parsed, separators=(',', ':'), sort_keys=True)
102
-
103
-
104
- def _serialize_attio_records(records: Sequence[object]) -> str:
105
- return json.dumps(records, separators=(',', ':'), sort_keys=True)
106
-
107
-
108
- class _AttioTools:
109
- def __init__(self, agent: _SdkTerseAgent) -> None:
110
- self._agent = agent
111
- {{#each attio.tools}}
112
- {{#if (eq name "attio_list_objects")}}{{> attio-list-objects-method tool=this attio=../attio}}{{/if}}
113
- {{#if (eq name "attio_query_records")}}{{> attio-query-records-method tool=this attio=../attio}}{{/if}}
114
- {{#if (eq name "attio_upsert_record")}}{{> attio-upsert-record-method tool=this attio=../attio}}{{/if}}
115
- {{/each}}
116
- {{/if}}
117
- {{#if hasSlackTools}}
118
-
119
- def _normalize_slack_channel_id(channel: object) -> str:
120
- if hasattr(channel, 'channel_id'):
121
- return str(getattr(channel, 'channel_id'))
122
- return str(channel)
123
-
124
-
125
- def _serialize_slack_blocks(blocks: object | None) -> str | None:
126
- if blocks is None:
127
- return None
128
- if isinstance(blocks, str):
129
- return blocks
130
- return json.dumps(blocks, separators=(',', ':'))
131
-
132
-
133
- class _SlackTools:
134
- def __init__(self, agent: _SdkTerseAgent) -> None:
135
- self._agent = agent
136
- {{#each slack.tools}}
137
- {{#if (eq name "slack_send_message")}}
138
-
139
- def send_message(
140
- self,
141
- *,
142
- channel: SlackChannel | str,
143
- message: str,
144
- thread_ts: str | None = None,
145
- blocks: object | None = None,
146
- ) -> SlackSendMessageToolOutput:
147
- return SlackSendMessageToolOutput.model_validate(
148
- self._agent.execute_tool(
149
- {{{nameRepr}}},
150
- _compact_dict(
151
- integrationId={{{../slack.instanceIdRepr}}},
152
- channelId=_normalize_slack_channel_id(channel),
153
- message=message,
154
- thread_ts=thread_ts,
155
- blocks=_serialize_slack_blocks(blocks),
156
- ),
157
- )
158
- )
159
- {{/if}}
160
- {{#if (eq name "slack_list_channels")}}
161
-
162
- def list_channels(
163
- self,
164
- *,
165
- types: str | None = None,
166
- limit: int | None = None,
167
- cursor: str | None = None,
168
- ) -> SlackListChannelsToolOutput:
169
- return SlackListChannelsToolOutput.model_validate(
170
- self._agent.execute_tool(
171
- {{{nameRepr}}},
172
- _compact_dict(
173
- integrationId={{{../slack.instanceIdRepr}}},
174
- types=types,
175
- limit=limit,
176
- cursor=cursor,
177
- ),
178
- )
179
- )
180
- {{/if}}
181
- {{#if (eq name "slack_list_users")}}
182
-
183
- def list_users(self, *, query: str | None = None) -> SlackListUsersToolOutput:
184
- return SlackListUsersToolOutput.model_validate(
185
- self._agent.execute_tool(
186
- {{{nameRepr}}},
187
- _compact_dict(
188
- integrationId={{{../slack.instanceIdRepr}}},
189
- query=query,
190
- ),
191
- )
192
- )
193
- {{/if}}
194
- {{#if (eq name "slack_read_conversation")}}
195
-
196
- def read_conversation(
197
- self,
198
- *,
199
- channel: SlackChannel | str,
200
- limit: int | None = None,
201
- cursor: str | None = None,
202
- ) -> SlackReadConversationToolOutput:
203
- return SlackReadConversationToolOutput.model_validate(
204
- self._agent.execute_tool(
205
- {{{nameRepr}}},
206
- _compact_dict(
207
- integrationId={{{../slack.instanceIdRepr}}},
208
- channelId=_normalize_slack_channel_id(channel),
209
- limit=limit,
210
- cursor=cursor,
211
- ),
212
- )
213
- )
214
- {{/if}}
215
- {{/each}}
216
- {{/if}}
217
- {{#if hasSnowflakeTools}}
218
-
219
- class _SnowflakeTools:
220
- def __init__(self, agent: _SdkTerseAgent) -> None:
221
- self._agent = agent
222
- {{#each snowflake.tools}}
223
-
224
- def {{methodName}}(self, query: str) -> {{outputModel}}:
225
- return {{outputModel}}.model_validate(
226
- self._agent.execute_tool(
227
- {{{nameRepr}}},
228
- {'integrationId': {{{../snowflake.instanceIdRepr}}}, 'query': query},
229
- )
230
- )
231
- {{/each}}
232
- {{/if}}
233
- {{#if hasAnyDeterministicTools}}
234
-
235
- class GeneratedTools:
236
- {{#if hasAttioTools}}
237
- attio: _AttioTools
238
- {{/if}}
239
- {{#if hasSlackTools}}
240
- slack: _SlackTools
241
- {{/if}}
242
- {{#if hasSnowflakeTools}}
243
- snowflake: _SnowflakeTools
244
- {{/if}}
245
-
246
- def __init__(
247
- self,
248
- {{#if hasAttioTools}}
249
- attio: _AttioTools | None = None,
250
- {{/if}}
251
- {{#if hasSlackTools}}
252
- slack: _SlackTools | None = None,
253
- {{/if}}
254
- {{#if hasSnowflakeTools}}
255
- snowflake: _SnowflakeTools | None = None,
256
- {{/if}}
257
- ) -> None:
258
- {{#if hasAttioTools}}
259
- if attio is not None:
260
- self.attio = attio
261
- {{/if}}
262
- {{#if hasSlackTools}}
263
- if slack is not None:
264
- self.slack = slack
265
- {{/if}}
266
- {{#if hasSnowflakeTools}}
267
- if snowflake is not None:
268
- self.snowflake = snowflake
269
- {{/if}}
270
- {{else}}
271
-
272
- class GeneratedTools:
273
- pass
274
- {{/if}}
275
-
276
-
277
- class TerseAgent(_SdkTerseAgent):
278
- tools: GeneratedTools
279
-
280
-
281
- def create_tools(agent: _SdkTerseAgent) -> GeneratedTools:
282
- manual_tool_configs = getattr(agent, "manual_tool_configs", None) or agent.skills
283
- allowed = {config.integration_type for config in manual_tool_configs}
284
- {{#if hasAnyDeterministicTools}}
285
- return GeneratedTools(
286
- {{#if hasAttioTools}}
287
- attio=_AttioTools(agent) if 'attio' in allowed else None,
288
- {{/if}}
289
- {{#if hasSlackTools}}
290
- slack=_SlackTools(agent) if 'slack' in allowed else None,
291
- {{/if}}
292
- {{#if hasSnowflakeTools}}
293
- snowflake=_SnowflakeTools(agent) if 'snowflake' in allowed else None,
294
- {{/if}}
295
- )
296
- {{else}}
297
- _ = allowed
298
- return GeneratedTools()
299
- {{/if}}
300
-
301
-
302
- def attach_tools(agent: _SdkTerseAgent) -> GeneratedTools:
303
- tools = create_tools(agent)
304
- agent.attach_tools(tools)
305
- return tools
306
-
307
-
308
- __all__ = {{{exportedNamesRepr}}}
@@ -1,32 +0,0 @@
1
- """
2
- Generated by `terse generate`. Do not edit manually.
3
-
4
- Type checking:
5
- uv run ty check src/
6
- """
7
-
8
- from __future__ import annotations
9
- {{#if typingImportsLine}}
10
-
11
- {{typingImportsLine}}
12
- {{/if}}
13
- {{#if pydanticImportsLine}}
14
-
15
- {{pydanticImportsLine}}
16
- {{/if}}
17
- {{#if needsJsonImport}}
18
-
19
- import json
20
- {{/if}}
21
-
22
- from terse_sdk import (
23
- {{#each sdkImports}}
24
- {{this}},
25
- {{/each}}
26
- )
27
-
28
-
29
- def _compact_dict(**values: object) -> dict[str, object]:
30
- """Drop None values while preserving falsey config values like False and []."""
31
-
32
- return {key: value for key, value in values.items() if value is not None}
@@ -1,149 +0,0 @@
1
- {{~#if github}}
2
-
3
-
4
- # === GitHub ===
5
-
6
-
7
- class GitHubOwner(BaseModel):
8
- model_config = ConfigDict(frozen=True)
9
- name: str
10
- {{#if github.owners.length}}
11
- {{#each github.owners}}
12
- {{staticName}}: ClassVar["GitHubOwner"]
13
- {{/each}}
14
- {{#each github.owners}}
15
-
16
- GitHubOwner.{{staticName}} = GitHubOwner(name={{{nameRepr}}})
17
- {{/each}}
18
- {{/if}}
19
-
20
-
21
- class GitHubRepo(BaseModel):
22
- model_config = ConfigDict(frozen=True)
23
- repository_id: int
24
- name: str
25
- owner: GitHubOwner
26
- full_name: str
27
- {{#each github.repoGroups}}
28
- {{#each repos}}
29
- {{staticName}}: ClassVar["GitHubRepo"]
30
- {{/each}}
31
- {{/each}}
32
- {{#each github.repoGroups}}
33
- {{#each repos}}
34
-
35
- GitHubRepo.{{staticName}} = GitHubRepo(
36
- repository_id={{{repositoryId}}},
37
- name={{{nameRepr}}},
38
- owner=GitHubOwner.{{ownerStaticName}},
39
- full_name={{{fullNameRepr}}},
40
- )
41
- {{/each}}
42
- {{/each}}
43
-
44
-
45
- class GitHub:
46
- @staticmethod
47
- def on_push(*, repo: GitHubRepo) -> TriggerConfig[GithubPushTrigger]:
48
- return TriggerConfig(
49
- integration_id={{{github.instanceIdRepr}}},
50
- integration_type='github',
51
- config_type='github',
52
- config=_compact_dict(
53
- repositoryIds=[repo.repository_id],
54
- eventTypes=[GitHubEventType.push],
55
- ),
56
- )
57
-
58
- @staticmethod
59
- def on_pr_opened(*, repo: GitHubRepo) -> TriggerConfig[GithubPROpenedTrigger]:
60
- return TriggerConfig(
61
- integration_id={{{github.instanceIdRepr}}},
62
- integration_type='github',
63
- config_type='github',
64
- config=_compact_dict(
65
- repositoryIds=[repo.repository_id],
66
- eventTypes=[GitHubEventType.pull_request_opened],
67
- ),
68
- )
69
-
70
- @staticmethod
71
- def on_pr_merged(*, repo: GitHubRepo) -> TriggerConfig[GithubPRMergedTrigger]:
72
- return TriggerConfig(
73
- integration_id={{{github.instanceIdRepr}}},
74
- integration_type='github',
75
- config_type='github',
76
- config=_compact_dict(
77
- repositoryIds=[repo.repository_id],
78
- eventTypes=[GitHubEventType.pull_request_merged],
79
- ),
80
- )
81
-
82
- @staticmethod
83
- def on_pr_closed(*, repo: GitHubRepo) -> TriggerConfig[GithubPRClosedTrigger]:
84
- return TriggerConfig(
85
- integration_id={{{github.instanceIdRepr}}},
86
- integration_type='github',
87
- config_type='github',
88
- config=_compact_dict(
89
- repositoryIds=[repo.repository_id],
90
- eventTypes=[GitHubEventType.pull_request_closed],
91
- ),
92
- )
93
-
94
- @staticmethod
95
- def on_pr_synchronized(*, repo: GitHubRepo) -> TriggerConfig[GithubPRSynchronizedTrigger]:
96
- return TriggerConfig(
97
- integration_id={{{github.instanceIdRepr}}},
98
- integration_type='github',
99
- config_type='github',
100
- config=_compact_dict(
101
- repositoryIds=[repo.repository_id],
102
- eventTypes=[GitHubEventType.pull_request_synchronize],
103
- ),
104
- )
105
-
106
- @staticmethod
107
- def on_pr(*, repo: GitHubRepo) -> TriggerConfig[GithubPRTrigger]:
108
- return TriggerConfig(
109
- integration_id={{{github.instanceIdRepr}}},
110
- integration_type='github',
111
- config_type='github',
112
- config=_compact_dict(
113
- repositoryIds=[repo.repository_id],
114
- eventTypes=[
115
- GitHubEventType.pull_request_opened,
116
- GitHubEventType.pull_request_merged,
117
- GitHubEventType.pull_request_closed,
118
- GitHubEventType.pull_request_synchronize,
119
- ],
120
- ),
121
- )
122
-
123
- @staticmethod
124
- def trigger(
125
- *,
126
- repos: Sequence[GitHubRepo],
127
- event_types: Sequence[GitHubEventType] | None = None,
128
- ) -> TriggerConfig[GithubTrigger]:
129
- return TriggerConfig(
130
- integration_id={{{github.instanceIdRepr}}},
131
- integration_type='github',
132
- config_type='github',
133
- config=_compact_dict(
134
- repositoryIds=[repo.repository_id for repo in repos],
135
- eventTypes=list(event_types) if event_types is not None else None,
136
- ),
137
- )
138
-
139
- @staticmethod
140
- def skill(*, repos: Sequence[GitHubRepo]) -> SkillConfig[str]:
141
- return SkillConfig(
142
- integration_id={{{github.instanceIdRepr}}},
143
- integration_type='github',
144
- config_type='github',
145
- config=_compact_dict(
146
- repositoryIds=[repo.repository_id for repo in repos],
147
- ),
148
- )
149
- {{~/if}}
@@ -1,30 +0,0 @@
1
- {{~#if gmail}}
2
-
3
-
4
- # === Gmail ===
5
-
6
-
7
- class Gmail:
8
- @staticmethod
9
- def on_email() -> TriggerConfig[GmailTrigger]:
10
- return TriggerConfig(
11
- integration_id={{{gmail.instanceIdRepr}}},
12
- integration_type='gmail',
13
- config_type='gmail',
14
- config=_compact_dict(eventTypes=[GmailEventType.email_received]),
15
- )
16
-
17
- @staticmethod
18
- def trigger(
19
- *,
20
- event_types: Sequence[GmailEventType] | None = None,
21
- ) -> TriggerConfig[GmailTrigger]:
22
- return TriggerConfig(
23
- integration_id={{{gmail.instanceIdRepr}}},
24
- integration_type='gmail',
25
- config_type='gmail',
26
- config=_compact_dict(
27
- eventTypes=list(event_types) if event_types is not None else None,
28
- ),
29
- )
30
- {{~/if}}