canonical / canonical/source-wand

[Feature] Query Sourcecraft for existing packages

Open
#30 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
9
Forks
2
PR merge metrics
No merged PRs in 30d

Description

# Potential Solution
- https://api.staging.snapcraft.io/docs/bins.html#bin_find
- https://api.staging.snapcraft.io/docs/bins.html#bin_info

Example `bin_find`: `https://api.staging.snapcraft.io/v2/bins/find?q=yaml`
```
{
"results": [
{
"name": "go-github-go-yaml-yaml-v3",
"package-id": "7zMriCxPLPEK02xfQSLvSTWHZhORfZXg"
},
{
"name": "0xnishit-go-gopkg-yaml-v3",
"package-id": "2nJEdAfseayaapeGGKi5iANSgogA5UNz"
...
]
}
```

Example `bin_info`: `https://api.staging.snapcraft.io/v2/bins/info/0xnishit-go-gopkg-yaml-v3?fields=channel-map`
```
{
"channel-map": [
{
"channel": {
"name": "latest/edge",
"platform": {
"architecture": "amd64",
"channel": "24.04",
"name": "ubuntu"
},
"released-at": "2025-04-29T10:40:05.658127+00:00",
"risk": "edge",
"track": "latest"
}
}
],
"default-track": null,
"name": "0xnishit-go-gopkg-yaml-v3",
"package-id": "2nJEdAfseayaapeGGKi5iANSgogA5UNz"
}

```
## Algorithm
1. Search for the package using `bin_find` (or go straight to step 2)
2. Use `bin_info`
- 400 Error >> Resource Not Found
- 200 >> We get the channel information >> get the name (check that it matches)

If matches, we have the package name & name of the channel + platform
If not, we know we have to onboard this

**This step should be done during init**

## What Protocol We Need
- Standard Naming Convention >> `elts-`
- We want to make sure name of package & repo is the same

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the initialization flow in the Rust repository and trace how package and repository names are currently handled. Read the linked bin_find and bin_info API documentation, then verify the 400/200 paths, channel and platform data, and the elts- naming rule. Done means init can distinguish an existing matching package from one that must be onboarded.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.