Skip to content

Commit c7fe3c7

Browse files
authored
docs: fix linting in docs (#749)
Fix long lines and table column width lints in docs.
1 parent dc2690b commit c7fe3c7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+857
-473
lines changed

CODE_OF_CONDUCT.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,21 @@ race, religion, or sexual identity and orientation.
1414
Examples of behavior that contributes to creating a positive environment
1515
include:
1616

17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
2222

2323
Examples of unacceptable behavior by participants include:
2424

25-
* The use of sexualized language or imagery and unwelcome sexual attention or
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
2626
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
3030
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
31+
* Other conduct which could reasonably be considered inappropriate in a
3232
professional setting
3333

3434
## Our Responsibilities
@@ -75,7 +75,7 @@ receive and address reported violations of the code of conduct. They will then
7575
work with a committee consisting of representatives from the Open Source
7676
Programs Office and the Google Open Source Strategy team. If for any reason you
7777
are uncomfortable reaching out to the Project Steward, please email
78-
78+
7979

8080
We will investigate every complaint, but you may not receive a direct response.
8181
We will use our discretion in determining when and how to follow up on reported
@@ -90,4 +90,4 @@ harassment or threats to anyone's safety, we may take action without notice.
9090

9191
This Code of Conduct is adapted from the Contributor Covenant, version 1.4,
9292
available at
93-
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
93+
<https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>

CONTRIBUTING.md

Lines changed: 100 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -32,71 +32,111 @@ use GitHub pull requests for this purpose. Consult
3232
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
3333
information on using pull requests.
3434

35-
Within 2-5 days, a reviewer will review your PR. They may approve it, or request changes. When requesting changes, reviewers should self-assign the PR to ensure they are aware of any updates.
36-
If additional changes are needed, push additional commits to your PR branch - this helps the reviewer know which parts of the PR have changed. Commits will be squashed when merged.
37-
Please follow up with changes promptly. If a PR is awaiting changes by the author for more than 10 days, maintainers may mark that PR as Draft. PRs that are inactive for more than 30 days may be closed.
38-
35+
Within 2-5 days, a reviewer will review your PR. They may approve it, or request
36+
changes. When requesting changes, reviewers should self-assign the PR to ensure
37+
they are aware of any updates.
38+
If additional changes are needed, push additional commits to your PR branch -
39+
this helps the reviewer know which parts of the PR have changed. Commits will be
40+
squashed when merged.
41+
Please follow up with changes promptly. If a PR is awaiting changes by the
42+
author for more than 10 days, maintainers may mark that PR as Draft. PRs that
43+
are inactive for more than 30 days may be closed.
3944

4045
### Adding a New Database Source and Tool
4146

42-
We recommend creating an [issue](https://github.com/googleapis/genai-toolbox/issues) before implementation to ensure we can accept the contribution and no duplicated work. If you have any questions, reach out on our [Discord](https://discord.gg/Dmm69peqjh) to chat directly with the team. New contributions should be added with both unit tests and integration tests.
47+
We recommend creating an
48+
[issue](https://github.com/googleapis/genai-toolbox/issues) before
49+
implementation to ensure we can accept the contribution and no duplicated work.
50+
If you have any questions, reach out on our
51+
[Discord](https://discord.gg/Dmm69peqjh) to chat directly with the team. New
52+
contributions should be added with both unit tests and integration tests.
4353

4454
#### 1. Implement the New Data Source
4555

46-
We recommend looking at an [example source implementation](https://github.com/googleapis/genai-toolbox/blob/main/internal/sources/postgres/postgres.go).
47-
48-
* **Create a new directory** under `internal/sources` for your database type (e.g., `internal/sources/newdb`).
49-
* **Define a configuration struct** for your data source in a file named `newdb.go`. Create a `Config` struct to include all the necessary parameters for connecting to the database (e.g., host, port, username, password, database name) and a `Source` struct to store necessary parameters for tools (e.g., Name, Kind, connection object, additional config).
50-
* **Implement the [`SourceConfig`](https://github.com/googleapis/genai-toolbox/blob/fd300dc606d88bf9f7bba689e2cee4e3565537dd/internal/sources/sources.go#L57) interface**. This interface requires two methods:
51-
* `SourceConfigKind() string`: Returns a unique string identifier for your data source (e.g., `"newdb"`).
52-
* `Initialize(ctx context.Context, tracer trace.Tracer) (Source, error)`: Creates a new instance of your data source and establishes a connection to the database.
53-
* **Implement the [`Source`](https://github.com/googleapis/genai-toolbox/blob/fd300dc606d88bf9f7bba689e2cee4e3565537dd/internal/sources/sources.go#L63) interface**. This interface requires one method:
54-
* `SourceKind() string`: Returns the same string identifier as `SourceConfigKind()`.
55-
* **Implement `init()`** to register the new Source.
56-
* **Implement Unit Tests** in a file named `newdb_test.go`.
56+
We recommend looking at an [example source
57+
implementation](https://github.com/googleapis/genai-toolbox/blob/main/internal/sources/postgres/postgres.go).
58+
59+
* **Create a new directory** under `internal/sources` for your database type
60+
(e.g., `internal/sources/newdb`).
61+
* **Define a configuration struct** for your data source in a file named
62+
`newdb.go`. Create a `Config` struct to include all the necessary parameters
63+
for connecting to the database (e.g., host, port, username, password, database
64+
name) and a `Source` struct to store necessary parameters for tools (e.g.,
65+
Name, Kind, connection object, additional config).
66+
* **Implement the
67+
[`SourceConfig`](https://github.com/googleapis/genai-toolbox/blob/fd300dc606d88bf9f7bba689e2cee4e3565537dd/internal/sources/sources.go#L57)
68+
interface**. This interface requires two methods:
69+
* `SourceConfigKind() string`: Returns a unique string identifier for your
70+
data source (e.g., `"newdb"`).
71+
* `Initialize(ctx context.Context, tracer trace.Tracer) (Source, error)`:
72+
Creates a new instance of your data source and establishes a connection to
73+
the database.
74+
* **Implement the
75+
[`Source`](https://github.com/googleapis/genai-toolbox/blob/fd300dc606d88bf9f7bba689e2cee4e3565537dd/internal/sources/sources.go#L63)
76+
interface**. This interface requires one method:
77+
* `SourceKind() string`: Returns the same string identifier as `SourceConfigKind()`.
78+
* **Implement `init()`** to register the new Source.
79+
* **Implement Unit Tests** in a file named `newdb_test.go`.
5780

5881
#### 2. Implement the New Tool
5982

60-
We recommend looking at an [example tool implementation](https://github.com/googleapis/genai-toolbox/tree/main/internal/tools/postgressql).
61-
62-
* **Create a new directory** under `internal/tools` for your tool type (e.g., `internal/tools/newdb` or `internal/tools/newdb<tool_name>`).
63-
* **Define a configuration struct** for your tool in a file named `newdbtool.go`.
64-
Create a `Config` struct and a `Tool` struct to store necessary parameters for tools.
65-
* **Implement the [`ToolConfig`](https://github.com/googleapis/genai-toolbox/blob/fd300dc606d88bf9f7bba689e2cee4e3565537dd/internal/tools/tools.go#L61) interface**. This interface requires one method:
66-
* `ToolConfigKind() string`: Returns a unique string identifier for your tool (e.g., `"newdb"`).
67-
* `Initialize(sources map[string]Source) (Tool, error)`: Creates a new instance of your tool and validates that it can connect to the specified data source.
68-
* **Implement the `Tool` interface**. This interface requires the following methods:
69-
* `Invoke(ctx context.Context, params map[string]any) ([]any, error)`: Executes the operation on the database using the provided parameters.
70-
* `ParseParams(data map[string]any, claims map[string]map[string]any) (ParamValues, error)`: Parses and validates the input parameters.
71-
* `Manifest() Manifest`: Returns a manifest describing the tool's capabilities and parameters.
72-
* `McpManifest() McpManifest`: Returns an MCP manifest describing the tool for use with the Model Context Protocol.
73-
* `Authorized(services []string) bool`: Checks if the tool is authorized to run based on the provided authentication services.
74-
* **Implement `init()`** to register the new Tool.
75-
* **Implement Unit Tests** in a file named `newdb_test.go`.
83+
We recommend looking at an [example tool
84+
implementation](https://github.com/googleapis/genai-toolbox/tree/main/internal/tools/postgressql).
85+
86+
* **Create a new directory** under `internal/tools` for your tool type (e.g.,
87+
`internal/tools/newdb` or `internal/tools/newdb<tool_name>`).
88+
* **Define a configuration struct** for your tool in a file named `newdbtool.go`.
89+
Create a `Config` struct and a `Tool` struct to store necessary parameters for
90+
tools.
91+
* **Implement the
92+
[`ToolConfig`](https://github.com/googleapis/genai-toolbox/blob/fd300dc606d88bf9f7bba689e2cee4e3565537dd/internal/tools/tools.go#L61)
93+
interface**. This interface requires one method:
94+
* `ToolConfigKind() string`: Returns a unique string identifier for your tool
95+
(e.g., `"newdb"`).
96+
* `Initialize(sources map[string]Source) (Tool, error)`: Creates a new
97+
instance of your tool and validates that it can connect to the specified
98+
data source.
99+
* **Implement the `Tool` interface**. This interface requires the following
100+
methods:
101+
* `Invoke(ctx context.Context, params map[string]any) ([]any, error)`:
102+
Executes the operation on the database using the provided parameters.
103+
* `ParseParams(data map[string]any, claims map[string]map[string]any)
104+
(ParamValues, error)`: Parses and validates the input parameters.
105+
* `Manifest() Manifest`: Returns a manifest describing the tool's capabilities
106+
and parameters.
107+
* `McpManifest() McpManifest`: Returns an MCP manifest describing the tool for
108+
use with the Model Context Protocol.
109+
* `Authorized(services []string) bool`: Checks if the tool is authorized to
110+
run based on the provided authentication services.
111+
* **Implement `init()`** to register the new Tool.
112+
* **Implement Unit Tests** in a file named `newdb_test.go`.
76113

77114
#### 3. Add Integration Tests
78115

79-
* **Add a test file** under a new directory `tests/newdb`.
80-
* **Add pre-defined integration test suites** in the `/tests/newdb/newdb_test.go` that are **required** to be run as long as your code contains related
81-
features:
116+
* **Add a test file** under a new directory `tests/newdb`.
117+
* **Add pre-defined integration test suites** in the
118+
`/tests/newdb/newdb_test.go` that are **required** to be run as long as your
119+
code contains related features:
82120

83121
1. [RunToolGetTest][tool-get]: tests for the `GET` endpoint that returns the
84122
tool's manifest.
85-
123+
86124
2. [RunToolInvokeTest][tool-call]: tests for tool calling through the native
87125
Toolbox endpoints.
88-
126+
89127
3. [RunMCPToolCallMethod][mcp-call]: tests tool calling through the MCP
90128
endpoints.
91-
129+
92130
4. (Optional) [RunExecuteSqlToolInvokeTest][execute-sql]: tests an
93131
`execute-sql` tool for any source. Only run this test if you are adding an
94132
`execute-sql` tool.
95-
133+
96134
5. (Optional) [RunToolInvokeWithTemplateParameters][temp-param]: tests for [template
97-
parameters][temp-param-doc]. Only run this test if template parameters apply to your tool.
135+
parameters][temp-param-doc]. Only run this test if template
136+
parameters apply to your tool.
98137

99-
* **Add the new database to the test config** in [integration.cloudbuild.yaml](.ci/integration.cloudbuild.yaml).
138+
* **Add the new database to the test config** in
139+
[integration.cloudbuild.yaml](.ci/integration.cloudbuild.yaml).
100140

101141
[tool-get]:
102142
https://github.com/googleapis/genai-toolbox/blob/fd300dc606d88bf9f7bba689e2cee4e3565537dd/tests/tool.go#L31
@@ -113,20 +153,30 @@ features:
113153

114154
#### 4. Add Documentation
115155

116-
* **Update the documentation** to include information about your new data source and tool. This includes:
117-
* Adding a new page to the `docs/en/resources/sources` directory for your data source.
118-
* Adding a new page to the `docs/en/resources/tools` directory for your tool.
156+
* **Update the documentation** to include information about your new data source
157+
and tool. This includes:
158+
* Adding a new page to the `docs/en/resources/sources` directory for your data
159+
source.
160+
* Adding a new page to the `docs/en/resources/tools` directory for your tool.
119161

120-
* **(Optional) Add samples** to the `docs/en/samples/<newdb>` directory.
162+
* **(Optional) Add samples** to the `docs/en/samples/<newdb>` directory.
121163

122164
#### (Optional) 5. Add Prebuilt Tools
123165

124-
You can provide developers with a set of "build-time" tools to aid common software development user journeys like viewing and creating tables/collections and data.
166+
You can provide developers with a set of "build-time" tools to aid common
167+
software development user journeys like viewing and creating tables/collections
168+
and data.
125169

126-
* **Create a set of prebuilt tools** by defining a new `tools.yaml` and adding it to `internal/tools`. Make sure the file name matches the source (i.e. for source "alloydb-postgres" create a file named "alloydb-postgres.yaml").
127-
* **Update `cmd/root.go`** to add new source to the `prebuilt` flag.
128-
* **Add tests** in [internal/prebuiltconfigs/prebuiltconfigs_test.go](internal/prebuiltconfigs/prebuiltconfigs_test.go) and [cmd/root_test.go](cmd/root_test.go).
170+
* **Create a set of prebuilt tools** by defining a new `tools.yaml` and adding
171+
it to `internal/tools`. Make sure the file name matches the source (i.e. for
172+
source "alloydb-postgres" create a file named "alloydb-postgres.yaml").
173+
* **Update `cmd/root.go`** to add new source to the `prebuilt` flag.
174+
* **Add tests** in
175+
[internal/prebuiltconfigs/prebuiltconfigs_test.go](internal/prebuiltconfigs/prebuiltconfigs_test.go)
176+
and [cmd/root_test.go](cmd/root_test.go).
129177

130178
#### 6. Submit a Pull Request
131179

132-
* **Submit a pull request** to the repository with your changes. Be sure to include a detailed description of your changes and any requests for long term testing resources.
180+
* **Submit a pull request** to the repository with your changes. Be sure to
181+
include a detailed description of your changes and any requests for long term
182+
testing resources.

0 commit comments

Comments
 (0)