Skip to content
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

feat: add CLI #39

Merged
merged 8 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"packages": {
"packages/access-client": {},
"packages/blob-index": {},
"packages/cli": {},
"packages/filecoin-api": {},
"packages/filecoin-client": {},
"packages/capabilities": {},
Expand Down
1 change: 1 addition & 0 deletions .github/release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"packages/access-client": "0.0.0",
"packages/blob-index": "0.0.0",
"packages/cli": "0.0.0",
"packages/filecoin-api": "0.0.0",
"packages/filecoin-client": "0.0.0",
"packages/capabilities": "1.0.0",
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: cli
on:
push:
branches:
- main
paths:
- 'packages/cli/**'
- 'packages/eslint-config-w3up/**'
- '.github/workflows/cli.yml'
- 'pnpm-lock.yaml'
pull_request:
paths:
- 'packages/cli/**'
- 'packages/eslint-config-w3up/**'
- '.github/workflows/cli.yml'
- 'pnpm-lock.yaml'
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
node_version:
- 18
- 20
defaults:
run:
working-directory: ./packages/cli
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install
uses: pnpm/action-setup@v4
- name: Setup
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
registry-url: https://registry.npmjs.org/
cache: 'pnpm'
- run: pnpm install
- run: pnpm -r --filter @storacha/cli run lint
- run: pnpm -r --filter @storacha/cli run check
- run: pnpm -r --filter @storacha/cli run test
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
contains(fromJson(needs.release.outputs.paths_released), 'packages/access-client') ||
contains(fromJson(needs.release.outputs.paths_released), 'packages/blob-index') ||
contains(fromJson(needs.release.outputs.paths_released), 'packages/capabilities') ||
contains(fromJson(needs.release.outputs.paths_released), 'packages/cli') ||
contains(fromJson(needs.release.outputs.paths_released), 'packages/did-mailto') ||
contains(fromJson(needs.release.outputs.paths_released), 'packages/upload-client') ||
contains(fromJson(needs.release.outputs.paths_released), 'packages/upload-api') ||
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/w3up-client.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: w3up-client
name: client
on:
push:
branches:
Expand Down
2 changes: 1 addition & 1 deletion packages/access-client/test/agent-use-cases.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ describe('authorizeWaitAndClaim', async function () {
describe('getAccountPlan', async function () {
const accountWithAPlan = 'did:mailto:example.com:i-have-a-plan'
const accountWithoutAPlan = 'did:mailto:example.com:i-have-no-plan'
const product = 'did:web:test.storacha.network'
const product = 'did:web:test.upload.storacha.network'
/** @type {Record<Ucanto.DID, {product: Ucanto.DID, updatedAt: string}>} */
const plans = {
[accountWithAPlan]: {
Expand Down
34 changes: 17 additions & 17 deletions packages/capabilities/test/capabilities/provider.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.storacha.network',
provider: 'did:web:test.upload.storacha.network',
consumer: space.did(),
},
proofs: await createAuthorization({ agent, service, account }),
Expand All @@ -36,7 +36,7 @@ describe('provider/add', function () {
assert.deepEqual(result.ok.audience.did(), service.did())
assert.equal(result.ok.capability.can, 'provider/add')
assert.deepEqual(result.ok.capability.nb, {
provider: 'did:web:test.storacha.network',
provider: 'did:web:test.upload.storacha.network',
consumer: space.did(),
})
}
Expand All @@ -51,7 +51,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.storacha.network',
provider: 'did:web:test.upload.storacha.network',
consumer: space.did(),
},
})
Expand Down Expand Up @@ -80,7 +80,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.storacha.network',
provider: 'did:web:test.upload.storacha.network',
consumer: space.did(),
},
proofs: [delegation],
Expand Down Expand Up @@ -110,7 +110,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.storacha.network',
provider: 'did:web:test.upload.storacha.network',
consumer: space.did(),
},
proofs: [attestation],
Expand All @@ -135,7 +135,7 @@ describe('provider/add', function () {
with: bobAccount.did(),
// @ts-ignore
nb: {
provider: 'did:web:test.storacha.network',
provider: 'did:web:test.upload.storacha.network',
},
})
}, /Error: Invalid 'nb' - Object contains invalid field "consumer"/)
Expand All @@ -149,7 +149,7 @@ describe('provider/add', function () {
audience: service,
with: bobAccount.did(),
nb: {
provider: 'did:web:test.storacha.network',
provider: 'did:web:test.upload.storacha.network',
// @ts-expect-error
consumer: 'did:mailto:storacha.network:user',
},
Expand All @@ -166,7 +166,7 @@ describe('provider/add', function () {
with: bobAccount.did(),
// @ts-expect-error - missing provider
nb: {
// provider: 'did:web:test.storacha.network',
// provider: 'did:web:test.upload.storacha.network',
consumer: bob.did(),
},
})
Expand Down Expand Up @@ -197,7 +197,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.storacha.network',
provider: 'did:web:test.upload.storacha.network',
consumer: space.did(),
},
proofs: [
Expand All @@ -206,7 +206,7 @@ describe('provider/add', function () {
audience: bob,
with: account,
nb: {
provider: 'did:web:test.storacha.network',
provider: 'did:web:test.upload.storacha.network',
consumer: space.did(),
},
proofs: await createAuthorization({ agent, service, account }),
Expand All @@ -233,7 +233,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.storacha.network',
provider: 'did:web:test.upload.storacha.network',
consumer: space.did(),
},
proofs: [
Expand All @@ -242,7 +242,7 @@ describe('provider/add', function () {
audience: bob,
with: account,
nb: {
provider: 'did:web:test.storacha.network',
provider: 'did:web:test.upload.storacha.network',
},
proofs: await createAuthorization({ agent, service, account }),
}),
Expand All @@ -268,7 +268,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.storacha.network',
provider: 'did:web:test.upload.storacha.network',
consumer: space.did(),
},
proofs: [
Expand Down Expand Up @@ -303,7 +303,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.storacha.network',
provider: 'did:web:test.upload.storacha.network',
consumer: bob.did(),
},
proofs: [
Expand Down Expand Up @@ -338,7 +338,7 @@ describe('provider/add', function () {
audience: service,
with: account,
nb: {
provider: 'did:web:test.storacha.network',
provider: 'did:web:test.upload.storacha.network',
consumer: bob.did(),
},
proofs: [
Expand Down Expand Up @@ -379,7 +379,7 @@ describe('provider/add', function () {
audience: service,
with: 'did:mailto:mallory.com:bob',
nb: {
provider: 'did:web:test.storacha.network',
provider: 'did:web:test.upload.storacha.network',
consumer: bob.did(),
},
proofs: [
Expand Down Expand Up @@ -428,7 +428,7 @@ describe('provider/add', function () {
with: account.did(),
nb: {
consumer: space.did(),
provider: 'did:web:test.storacha.network',
provider: 'did:web:test.upload.storacha.network',
},
// NOTE: no proofs!
})
Expand Down
2 changes: 1 addition & 1 deletion packages/capabilities/test/helpers/fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const malloryAccount = Absentee.from({

export const service = Signer.parse(
'MgCYKXoHVy7Vk4/QjcEGi+MCqjntUiasxXJ8uJKY0qh11e+0Bs8WsdqGK7xothgrDzzWD0ME7ynPjz2okXDh8537lId8='
).withDID('did:web:test.storacha.network')
).withDID('did:web:test.upload.storacha.network')

export const readmeCID = parseLink(
'bafybeihqfdg2ereoijjoyrqzr2x2wsasqm2udurforw7pa3tvbnxhojao4'
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto
*.car -text
1 change: 1 addition & 0 deletions packages/cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
Loading
Loading