@domesystems/templates 0.1.1 → 0.3.0

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 (36) hide show
  1. package/README.md +16 -158
  2. package/package.json +8 -5
  3. package/src/cli.mjs +46 -232
  4. package/src/manifest.mjs +33 -0
  5. package/src/publish-files.mjs +68 -0
  6. package/src/registry.mjs +100 -0
  7. package/src/runtime.mjs +2 -2
  8. package/src/template-files.mjs +54 -5
  9. package/ai-agent-for-documentation/.env.example +0 -12
  10. package/ai-agent-for-documentation/app/agent.yaml +0 -31
  11. package/ai-agent-for-documentation/app/help.md +0 -19
  12. package/ai-agent-for-documentation/app/instructions.md +0 -21
  13. package/ai-agent-for-documentation/docker-compose.yml +0 -18
  14. package/ai-agent-for-documentation/dome.tf +0 -146
  15. package/ai-agent-for-documentation/rules/answerer.cedar +0 -35
  16. package/ai-agent-for-documentation/template.yaml +0 -131
  17. package/ai-agent-for-documentation/verification.json +0 -7
  18. package/ai-agent-for-notion/.env.example +0 -19
  19. package/ai-agent-for-notion/app/agent.yaml +0 -32
  20. package/ai-agent-for-notion/app/help.md +0 -14
  21. package/ai-agent-for-notion/app/instructions.md +0 -16
  22. package/ai-agent-for-notion/docker-compose.yml +0 -18
  23. package/ai-agent-for-notion/dome.tf +0 -163
  24. package/ai-agent-for-notion/guards/redact-ssn-from-pages.json +0 -22
  25. package/ai-agent-for-notion/rules/answerer.cedar +0 -29
  26. package/ai-agent-for-notion/template.yaml +0 -143
  27. package/ai-agent-for-notion/verification.json +0 -7
  28. package/ai-agent-for-release-notes/.env.example +0 -15
  29. package/ai-agent-for-release-notes/app/agent.yaml +0 -36
  30. package/ai-agent-for-release-notes/app/help.md +0 -20
  31. package/ai-agent-for-release-notes/app/instructions.md +0 -19
  32. package/ai-agent-for-release-notes/docker-compose.yml +0 -18
  33. package/ai-agent-for-release-notes/dome.tf +0 -165
  34. package/ai-agent-for-release-notes/guards/block-leaked-keys.json +0 -38
  35. package/ai-agent-for-release-notes/rules/release-notes.cedar +0 -49
  36. package/ai-agent-for-release-notes/template.yaml +0 -156
@@ -1,165 +0,0 @@
1
- terraform {
2
- required_providers {
3
- dome = { source = "dome-systems/dome", version = ">= 0.1.0" }
4
- }
5
- }
6
-
7
- variable "workspace_id" { type = string }
8
- variable "github_token" {
9
- type = string
10
- sensitive = true
11
- }
12
- variable "anthropic_api_key" {
13
- type = string
14
- sensitive = true
15
- }
16
-
17
- resource "dome_gateway" "release" {
18
- workspace_id = var.workspace_id
19
- name = "release"
20
- description = "Read-only GitHub surface for the release-notes job"
21
- is_default = true
22
- }
23
-
24
- resource "dome_mcp_connection" "github" {
25
- workspace_id = var.workspace_id
26
- name = "github"
27
- protocol = "streamable-http"
28
- url = "https://api.githubcopilot.com/mcp/"
29
- auth_method = "api-key"
30
- credential_type = "shared"
31
- secret_values = { Authorization = var.github_token }
32
- }
33
-
34
- resource "dome_llm_connection" "sonnet" {
35
- workspace_id = var.workspace_id
36
- name = "sonnet"
37
- provider_id = "anthropic"
38
- provider_config = jsonencode({ model = "claude-sonnet-5" })
39
- auth_method = "api-key"
40
- credential_type = "shared"
41
- secret_values = { Authorization = var.anthropic_api_key }
42
- }
43
-
44
- resource "dome_llm_pool" "release" {
45
- workspace_id = var.workspace_id
46
- name = "release-pool"
47
- is_default = true
48
- }
49
-
50
- resource "dome_llm_pool_member" "sonnet" {
51
- workspace_id = var.workspace_id
52
- pool = dome_llm_pool.release.name
53
- llm_connection = dome_llm_connection.sonnet.name
54
- }
55
-
56
- resource "dome_gateway_llm_pool" "release" {
57
- workspace_id = var.workspace_id
58
- gateway = dome_gateway.release.name
59
- llm_pool = dome_llm_pool.release.name
60
- }
61
-
62
- resource "dome_gateway_tool" "list_pull_requests" {
63
- workspace_id = var.workspace_id
64
- gateway = dome_gateway.release.name
65
- mcp_connection = dome_mcp_connection.github.name
66
- tool = "list_pull_requests"
67
- }
68
-
69
- resource "dome_gateway_tool" "pull_request_read" {
70
- workspace_id = var.workspace_id
71
- gateway = dome_gateway.release.name
72
- mcp_connection = dome_mcp_connection.github.name
73
- tool = "pull_request_read"
74
- }
75
-
76
- resource "dome_gateway_tool" "list_commits" {
77
- workspace_id = var.workspace_id
78
- gateway = dome_gateway.release.name
79
- mcp_connection = dome_mcp_connection.github.name
80
- tool = "list_commits"
81
- }
82
-
83
- resource "dome_gateway_tool" "create_issue" {
84
- workspace_id = var.workspace_id
85
- gateway = dome_gateway.release.name
86
- mcp_connection = dome_mcp_connection.github.name
87
- tool = "create_issue"
88
- }
89
-
90
- resource "dome_agent" "release_notes_writer" {
91
- workspace_id = var.workspace_id
92
- name = "release-notes-writer"
93
- allowed_gateways = [dome_gateway.release.name]
94
- }
95
-
96
- resource "dome_agent_rules_bundle" "release_notes_writer" {
97
- workspace_id = var.workspace_id
98
- agent = dome_agent.release_notes_writer.name
99
- files = {
100
- "release-notes.cedar" = <<-EOT
101
- permit ( principal, action == Dome::Action::"mcp:discover", resource );
102
- permit ( principal, action == Dome::Action::"mcp:call", resource == Dome::MCPTool::"github/list_pull_requests" );
103
- permit ( principal, action == Dome::Action::"mcp:call", resource == Dome::MCPTool::"github/pull_request_read" );
104
- permit ( principal, action == Dome::Action::"mcp:call", resource == Dome::MCPTool::"github/list_commits" );
105
- forbid ( principal, action == Dome::Action::"mcp:call", resource == Dome::MCPTool::"github/create_issue" );
106
- forbid ( principal, action == Dome::Action::"mcp:call", resource == Dome::MCPTool::"github/pull_request_read" ) when { resource.arguments.method == "get_diff" };
107
- EOT
108
- }
109
- }
110
-
111
- resource "dome_filter" "block_leaked_keys" {
112
- workspace_id = var.workspace_id
113
- name = "block-leaked-keys"
114
- description = "Withhold a tool result carrying a private key"
115
- config = jsonencode({
116
- json = { components = [{ fieldActions = [{ matcher = { path = "**.text", contentMatchers = [
117
- { substring = { value = "BEGIN RSA PRIVATE KEY" } },
118
- { substring = { value = "BEGIN OPENSSH PRIVATE KEY" } },
119
- { substring = { value = "BEGIN PRIVATE KEY" } },
120
- { substring = { value = "BEGIN EC PRIVATE KEY" } },
121
- ] }, action = "FILTER_ACTION_BLOCK" }] }] }
122
- })
123
- }
124
-
125
- resource "dome_mcp_connection_filters" "github_responses" {
126
- workspace_id = var.workspace_id
127
- mcp_connection = dome_mcp_connection.github.name
128
- direction = "response"
129
- filters = [dome_filter.block_leaked_keys.name]
130
- }
131
-
132
- resource "dome_quota" "agent_daily_spend" {
133
- workspace_id = var.workspace_id
134
- dimension = "llm"
135
- unit = "dome_usd"
136
- subject_type = "agent"
137
- subject = dome_agent.release_notes_writer.name
138
- scope = "total"
139
- window = "daily"
140
- limit_amount = 2000000
141
- name = "release-notes-writer daily spend"
142
- }
143
-
144
- resource "dome_quota" "github_calls" {
145
- workspace_id = var.workspace_id
146
- dimension = "tool"
147
- unit = "calls"
148
- subject_type = "tool_connection"
149
- subject = dome_mcp_connection.github.name
150
- scope = "total"
151
- window = "daily"
152
- limit_amount = 1000
153
- name = "github calls per day"
154
- }
155
-
156
- resource "dome_agent_key" "runtime" {
157
- workspace_id = var.workspace_id
158
- agent = dome_agent.release_notes_writer.name
159
- name = "runtime"
160
- }
161
-
162
- output "release_notes_writer_token" {
163
- value = dome_agent_key.runtime.token
164
- sensitive = true
165
- }
@@ -1,38 +0,0 @@
1
- {
2
- "json": {
3
- "components": [
4
- {
5
- "fieldActions": [
6
- {
7
- "matcher": {
8
- "path": "**.text",
9
- "contentMatchers": [
10
- {
11
- "substring": {
12
- "value": "BEGIN RSA PRIVATE KEY"
13
- }
14
- },
15
- {
16
- "substring": {
17
- "value": "BEGIN OPENSSH PRIVATE KEY"
18
- }
19
- },
20
- {
21
- "substring": {
22
- "value": "BEGIN PRIVATE KEY"
23
- }
24
- },
25
- {
26
- "substring": {
27
- "value": "BEGIN EC PRIVATE KEY"
28
- }
29
- }
30
- ]
31
- },
32
- "action": "FILTER_ACTION_BLOCK"
33
- }
34
- ]
35
- }
36
- ]
37
- }
38
- }
@@ -1,49 +0,0 @@
1
- // draft-release-notes — authorization rules
2
- //
3
- // Two kinds of boundary, which is why this template exists alongside the other
4
- // two. The first is the familiar one: a write tool is on the gateway and denied.
5
- // The second is the one MCP consolidation forces.
6
- //
7
- // GitHub replaced nine per-pull-request reads with a single `pull_request_read`
8
- // taking a `method` — get, get_diff, get_files, get_reviews, get_commits and
9
- // four more. A tool-name allow-list can only take all nine or none. Release
10
- // notes are written from titles, bodies and commits; the diff is the source
11
- // code, and there is no reason for it to reach a model. So the tool is
12
- // permitted and the one method is refused, on the argument.
13
-
14
- permit ( principal, action == Dome::Action::"mcp:discover", resource );
15
-
16
- permit (
17
- principal,
18
- action == Dome::Action::"mcp:call",
19
- resource == Dome::MCPTool::"github/list_pull_requests"
20
- );
21
-
22
- permit (
23
- principal,
24
- action == Dome::Action::"mcp:call",
25
- resource == Dome::MCPTool::"github/pull_request_read"
26
- );
27
-
28
- permit (
29
- principal,
30
- action == Dome::Action::"mcp:call",
31
- resource == Dome::MCPTool::"github/list_commits"
32
- );
33
-
34
- // A forbid is the only thing that narrows the auto-generated Agent Form, which
35
- // permits every tool attached to the gateway.
36
- forbid (
37
- principal,
38
- action == Dome::Action::"mcp:call",
39
- resource == Dome::MCPTool::"github/create_issue"
40
- );
41
-
42
- // Same tool as the permit above. The gateway evaluates this against the real
43
- // call arguments, so `method: get` is served and `method: get_diff` is refused.
44
- forbid (
45
- principal,
46
- action == Dome::Action::"mcp:call",
47
- resource == Dome::MCPTool::"github/pull_request_read"
48
- )
49
- when { resource.arguments.method == "get_diff" };
@@ -1,156 +0,0 @@
1
- apiVersion: templates.domesystems.ai/v1
2
- kind: Template
3
-
4
- metadata:
5
- name: draft-release-notes
6
- slug: ai-agent-for-release-notes
7
- title: Draft release notes from merged pull requests
8
- target_query: github ai agent release notes
9
- summary: >-
10
- A scheduled job that turns merged pull requests into a release-note draft.
11
- It can read one repository's
12
- pull requests and commits. It cannot open an issue, merge, or cut the
13
- release — and it cannot read the source diff, which is the same tool it is
14
- allowed to call, refused on one of its parameters.
15
- domain: engineering
16
- shape: scheduled-job
17
- ui: run
18
- business_pattern: consumes
19
- governance_interest: [read-only, tool-scoped-access, argument-scoped-access]
20
-
21
- # Library-only topology and documentation data. `dome.tf` is the deployable source.
22
- catalog:
23
- gateway:
24
- name: release
25
- description: Read-only GitHub surface for the release-notes job
26
- default: true
27
-
28
- connections:
29
- - name: github
30
- protocol: streamable-http
31
- url: https://api.githubcopilot.com/mcp/
32
- auth:
33
- method: api-key
34
- credential: shared
35
- secret:
36
- env: GITHUB_TOKEN
37
- variable: github_token
38
- label: a GitHub fine-grained personal access token
39
- steps:
40
- - "Create one at https://github.com/settings/personal-access-tokens/new"
41
- - "Scope it to the single repository you want release notes for"
42
- - "Read access to Contents and Pull requests is enough"
43
- - "export GITHUB_TOKEN=github_pat_..."
44
- note: "It goes into Dome, not into your app. This template never writes."
45
- # `get_pull_request` used to be here and does not exist. GitHub
46
- # consolidated nine per-PR reads into one `pull_request_read` taking a
47
- # `method`, with no deprecated alias — and `FilterTools` drops unknown
48
- # names silently, so the template would have quietly lost a tool.
49
- # Verified against github/github-mcp-server, then against the live
50
- # connection with `lint --live`.
51
- permit:
52
- - list_pull_requests
53
- - pull_request_read
54
- - list_commits
55
- # A real write, on the gateway on purpose so the model can try it. Cedar
56
- # forbids it, and a forbid beats the auto-generated Agent Form permit.
57
- forbid:
58
- - create_issue
59
- # And the consolidation problem itself. `pull_request_read` is permitted,
60
- # but one of its nine methods returns the source diff — which release
61
- # notes do not need and which puts the code in the model's context. A
62
- # tool-name allow-list cannot express that. Cedar on the arguments can,
63
- # and the gateway enforces it on the real call, not just in `simulate`.
64
- forbid_arguments:
65
- - tool: pull_request_read
66
- when: 'resource.arguments.method == "get_diff"'
67
- why: the diff is the source code, and release notes are written from titles and commits
68
- example_denied: { method: get_diff, owner: OWNER, repo: REPO, pullNumber: 1 }
69
- example_allowed: { method: get, owner: OWNER, repo: REPO, pullNumber: 1 }
70
-
71
- model:
72
- name: sonnet
73
- provider: anthropic
74
- model_id: claude-sonnet-5
75
- secret:
76
- env: ANTHROPIC_API_KEY
77
- variable: anthropic_api_key
78
- label: an Anthropic API key
79
-
80
- pool:
81
- name: release-pool
82
- default: true
83
-
84
- agent:
85
- name: release-notes-writer
86
-
87
- rules:
88
- file: rules/release-notes.cedar
89
-
90
- guards:
91
- filters:
92
- - name: block-leaked-keys
93
- description: Withhold a tool result carrying a private key
94
- why: >-
95
- Pull request bodies are prose written in a hurry, and private keys end
96
- up in them. This agent pipes that prose into a model, so a leaked key
97
- would be copied into a provider's context and into the draft. The
98
- result is blocked rather than redacted: if a key is in the payload,
99
- the right answer is that the agent does not get the payload.
100
- config: guards/block-leaked-keys.json
101
- bind: { tool: github, direction: response }
102
-
103
- quotas:
104
- # A headless job on a schedule is the thing most likely to run away
105
- # unnoticed, so the cap is tighter than the interactive templates'.
106
- - subject: agent
107
- agent: release-notes-writer
108
- unit: dome_usd
109
- limit: 2
110
- window: daily
111
- name: release-notes-writer daily spend
112
- # Counted in calls, not dollars, because what goes wrong with a repository
113
- # crawl is a rate limit rather than a bill.
114
- - subject: tool-connection
115
- connection: github
116
- unit: calls
117
- limit: 1000
118
- window: daily
119
- name: github calls per day
120
-
121
- app:
122
- runtime:
123
- pattern: run
124
- language: python
125
- image_tag: dev
126
- agent:
127
- prompt: app/instructions.md
128
- help: app/help.md
129
- # The run surface uses the first starter as its task prompt, and `${VAR}`
130
- # is filled from the declared run parameters below. Without the repo in
131
- # here the agent was told it would be "given the run parameters" and then
132
- # given nothing.
133
- starters:
134
- - Draft release notes for pull requests merged into ${TARGET_REPO} in the
135
- 14 days before ${TODAY}.
136
- model: claude-sonnet-5
137
- max_tokens: 8192
138
- skills:
139
- - name: draft-release-notes
140
- description: Read merged pull requests in a window and write user-facing notes.
141
- tools:
142
- - github/list_pull_requests
143
- - github/pull_request_read
144
- - github/list_commits
145
- - github/create_issue
146
- invoker:
147
- kind: cron
148
- schedule: "0 9 * * MON"
149
- options:
150
- identity:
151
- mode: none
152
- # Run parameters. `${VAR}` in a starter, prompt or help file is filled from
153
- # these; the label is what `.env.example` tells the reader to put there.
154
- env:
155
- - name: TARGET_REPO
156
- label: "the repository to draft notes for, as owner/repo — your choice, and the token must reach it"