-
Notifications
You must be signed in to change notification settings - Fork 31
feat(cli): dirctl validate #793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c373cff
feat(cli): add `validate` for local record validation
akijakya b8f3768
chore: update readmes for `task server:start`
akijakya 9124b90
feat: `-all` flag for `dirctl validate`
akijakya 67e6b82
feat: validate -all in batches
akijakya fcdd974
feat: test validation with example records
akijakya c998664
feat: remove --all, add input from stdin to dirctl validate
akijakya File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // Copyright AGNTCY Contributors (https://github.com/agntcy) | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package validate | ||
|
|
||
| var opts = &options{} | ||
|
|
||
| type options struct { | ||
| DisableAPI bool | ||
| DisableStrict bool | ||
| SchemaURL string | ||
| } | ||
|
|
||
| func init() { | ||
| flags := Command.Flags() | ||
|
|
||
| flags.BoolVar(&opts.DisableAPI, "disable-api", false, | ||
| "Disable API-based validation (use embedded schemas instead, required if --url is not specified)") | ||
| flags.BoolVar(&opts.DisableStrict, "disable-strict", false, | ||
| "Disable strict validation mode (more permissive validation, only works with --url)") | ||
| flags.StringVar(&opts.SchemaURL, "url", "", | ||
| "OASF schema URL for API-based validation (required if --disable-api is not specified)") | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| { | ||
| "name": "directory.agntcy.org/example/research-assistant-v4", | ||
| "version": "v4.0.0", | ||
| "schema_version": "0.8.0", | ||
| "description": "AI research assistant for data analysis and problem solving.", | ||
| "authors": [ | ||
| "AGNTCY Contributors" | ||
| ], | ||
| "created_at": "2025-03-19T17:06:37Z", | ||
| "annotations": { | ||
| "key": "value" | ||
| }, | ||
| "skills": [ | ||
| { | ||
| "id": 10201876 | ||
| }, | ||
| { | ||
| "name": "natural_language_processing/analytical_reasoning/problem_solving", | ||
| "id": 10702 | ||
| } | ||
| ], | ||
| "locators": [ | ||
| { | ||
| "type": "docker_image", | ||
| "url": "https://ghcr.io/agntcy/research-assistant" | ||
| } | ||
| ], | ||
| "domains": [ | ||
| { | ||
| "id": 301, | ||
| "name": "life_science/biotechnology" | ||
| } | ||
| ], | ||
| "modules": [ | ||
| { | ||
| "name": "core/llm/model", | ||
| "id": 10201, | ||
| "data": { | ||
| "models": [ | ||
| { | ||
| "provider": "openai", | ||
| "model": "gpt-4", | ||
| "api_base": "https://api.openai.com/v1", | ||
| "env_vars": [ | ||
| { | ||
| "name": "OPENAI_API_KEY", | ||
| "description": "OpenAI API key for authentication", | ||
| "required": true | ||
| }, | ||
| { | ||
| "name": "OPENAI_ORG_ID", | ||
| "description": "OpenAI organization ID", | ||
| "required": false, | ||
| "default_value": "" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ], | ||
| "previous_record_cid": "bafybeihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| { | ||
| "name": "directory.agntcy.org/example/research-assistant-v4", | ||
| "version": "v4.0.0", | ||
| "schema_version": "0.8.0", | ||
| "description": "AI research assistant for data analysis and problem solving.", | ||
| "authors": [ | ||
| "AGNTCY Contributors" | ||
| ], | ||
| "created_at": "2025-03-19T17:06:37Z", | ||
| "annotations": { | ||
| "key": "value" | ||
| }, | ||
| "skills": [ | ||
| { | ||
| "name": "natural_language_processing/natural_language_generation/text_completion", | ||
| "id": 10201 | ||
| }, | ||
| { | ||
| "name": "natural_language_processing/analytical_reasoning/problem_solving", | ||
| "id": 10702 | ||
| } | ||
| ], | ||
| "locators": [ | ||
| { | ||
| "type": "docker_image", | ||
| "url": "https://ghcr.io/agntcy/research-assistant" | ||
| } | ||
| ], | ||
| "domains": [ | ||
| { | ||
| "id": 301, | ||
| "name": "life_science/biotechnology" | ||
| } | ||
| ], | ||
| "modules": [ | ||
| { | ||
| "name": "core/llm/model", | ||
| "id": 10201, | ||
| "data": { | ||
| "models": [ | ||
| { | ||
| "provider": "openai", | ||
| "model": "gpt-4", | ||
| "api_base": "https://api.openai.com/v1", | ||
| "env_vars": [ | ||
| { | ||
| "name": "OPENAI_API_KEY", | ||
| "description": "OpenAI API key for authentication", | ||
| "required": true | ||
| }, | ||
| { | ||
| "name": "OPENAI_ORG_ID", | ||
| "description": "OpenAI organization ID", | ||
| "required": false, | ||
| "default_value": "" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ], | ||
| "previous_record_cid": "bafybeihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku" | ||
| } |
45 changes: 45 additions & 0 deletions
45
cli/cmd/validate/testdata/record_valid_for_non_strict.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| { | ||
| "name": "directory.agntcy.org/example/research-assistant-v4", | ||
| "version": "v4.0.0", | ||
| "schema_version": "0.8.0", | ||
| "description": "AI research assistant for data analysis and problem solving.", | ||
| "authors": [ | ||
| "AGNTCY Contributors" | ||
| ], | ||
| "created_at": "2025-03-19T17:06:37Z", | ||
| "annotations": { | ||
| "key": "value" | ||
| }, | ||
| "skills": [ | ||
| { | ||
| "name": "natural_language_processing/natural_language_generation/text_completion", | ||
| "id": 10201 | ||
| }, | ||
| { | ||
| "name": "natural_language_processing/analytical_reasoning/problem_solving", | ||
| "id": 10702 | ||
| } | ||
| ], | ||
| "locators": [ | ||
| { | ||
| "type": "docker_image", | ||
| "url": "https://ghcr.io/agntcy/research-assistant" | ||
| } | ||
| ], | ||
| "domains": [ | ||
| { | ||
| "id": 0, | ||
| "name": "base_domain" | ||
| } | ||
| ], | ||
| "modules": [ | ||
| { | ||
| "name": "license", | ||
| "data": { | ||
| "header": "Copyright (c) 2025 Cisco and/or its affiliates.", | ||
| "license": "Apache-2.0" | ||
| } | ||
| } | ||
| ], | ||
| "previous_record_cid": "bafybeihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| { | ||
| "name": "directory.agntcy.org/example/research-assistant-v4", | ||
| "version": "v4.0.0", | ||
| "schema_version": "0.8.0", | ||
| "description": "AI research assistant for data analysis and problem solving.", | ||
| "authors": [ | ||
| "AGNTCY Contributors" | ||
| ], | ||
| "created_at": "2025-03-19T17:06:37Z", | ||
| "annotations": { | ||
| "key": "value" | ||
| }, | ||
| "skills": [ | ||
| { | ||
| "name": "natural_language_processing/natural_language_generation/text_completion", | ||
| "id": 10201 | ||
| }, | ||
| { | ||
| "name": "natural_language_processing/analytical_reasoning/problem_solving", | ||
| "id": 10702 | ||
| } | ||
| ], | ||
| "locators": [ | ||
| { | ||
| "type": "docker_image", | ||
| "url": "https://ghcr.io/agntcy/research-assistant" | ||
| } | ||
| ], | ||
| "domains": [ | ||
| { | ||
| "id": 301, | ||
| "name": "life_science/biotechnology" | ||
| } | ||
| ], | ||
| "modules": [ | ||
| { | ||
| "name": "license", | ||
| "data": { | ||
| "header": "Copyright (c) 2025 Cisco and/or its affiliates.", | ||
| "license": "Apache-2.0" | ||
| } | ||
| } | ||
| ], | ||
| "previous_record_cid": "asdf" | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imo we do not need to reflect the config options set against the backend since this is our CLI approach. i still think that the flags are a bit unintuitive to work with and explain due to disable-first approach.