@kody/shopify
CONTRIBUTING.md
99 lines · 3.4 KB · MarkdownContributing to @kody/shopify
This package is designed to be forked, then grown in your own account.
The live @kody/shopify listing stays a shared starting point.
Fork and run
- Open https://kody.codes/@kody/shopify and fork it, or call
community_forkwith this listing id. - Review
src/lib/client.ts(auth, host allowlist, retries) before you adopt the fork or approve secrets. - Publish your copy.
- Save
shopifyClientId+shopifyClientSecret(orshopifyAdminAccessToken) and approve{shop}.myshopify.com. - Invoke
./smoke-testwith{ shop: "your-store" }throughpackages.invokesokody.secretMounts/ placeholders resolve in the package runtime.
import { packages } from 'kody:runtime'
export default async function main() {
return await packages.invoke({
kodyId: 'shopify',
exportName: './smoke-test',
params: { shop: 'your-store' },
})
}After the fork, optional defaults:
import { setDefaultShop } from 'kody:@your-user/shopify/config'
await setDefaultShop({ shop: 'your-store' })Do not call setDefaultShop against live @kody/shopify. That storage
belongs to the platform package, not your shop.
Authoring lane (maintainers / large edits)
Coding agents with filesystem access should use the git lane:
package_get_git_remotefor this package (kody_id: "shopify",package_scope: "kody"for the platform copy).- Clone into
/tmp, edit, test locally. - Commit and push.
package_publish_external_push.community_publishonly when the public snapshot should move.
Prefer that loop over repeated package_save blobs.
Add a domain module
Keep new helpers thin. Copy an existing file such as src/orders.ts.
- Add
src/your-resource.tswith named functions and a default export. - Use
shopifyGraphql/shopifyRequestRawfromsrc/lib/client.ts. Do not open a second fetch wrapper. - Accept
ShopifyClientOptions(shop,apiVersion). - Project slim return objects. Do not dump raw Shopify payloads unless the export is an escape hatch.
- Mutations default to
dryRun: true. RequiredryRun: falseto write. - Register the export in
package.json#exportsandsrc/index.ts. - Document it in the README export table and
docs/domains.md. - Add any new GraphQL field selections to
src/lib/fragments.tswhen they are reused.
Escape hatch first: if the resource is uncommon, document a
./graphql example instead of wrapping it.
Local checks you can run without a shop
src/lib/shop.ts exports runShopHelperSelfCheck(). ./smoke-test
always runs it. After you change shop/id/version parsing, invoke
./smoke-test without credentials and confirm { ok: true, live: false }.
Secrets and hosts
- Never echo resolvable
{{secret:name}}placeholders into logs or returned strings. Mention them as{{secret:<name>}}in prose. - Never persist exchanged access tokens in
packageStorage(). - Keep requests on
{shop}.myshopify.com/admin/. - New secrets should follow the existing names unless Shopify's contract changes. Update README setup URLs in the same commit.
Style
- TypeScript ESM, tab indentation,
.tsimport specifiers. - JSDoc on every exported function, with a short
@example. - Exhaustive
switchover unions uses aneverdefault. - No inline imports.
License
MIT. Keep package.json#license as MIT and do not set
"private": true if this copy should stay community-publishable.