Skip to content
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
7 changes: 6 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,14 @@ The installed version's guide is `node_modules/effect/AGENTS.md`; consult it for
the APIs the change touches, and search `node_modules/effect/src` for anything it
does not cover. Keep the pinned `effect` version.

`@effect/tsgo` adds Effect diagnostics to lint. Bare `vp check` cannot load them
and stops at `Unknown plugin: effecttsgo`; use `pnpm exec vp run check`. Rule
overrides are in [vite.config.ts](https://github.com/putdotio/putio-cli/blob/main/vite.config.ts), the unstable modules the CLI
accepts in [tsconfig.json](https://github.com/putdotio/putio-cli/blob/main/tsconfig.json).

## Proof

- Docs only: `pnpm exec vp check .`, plus `pnpm exec vp run skills:lint` for `skills/*`; no runtime proof.
- Docs only: `pnpm exec vp run check`, plus `pnpm exec vp run skills:lint` for `skills/*`; no runtime proof.
- Source change: `pnpm exec vp run verify`. Prefer in-process tests unless the process boundary is the behavior under test; add command-path coverage when the `effect/cli` command boundary changes.
- Commands, flags, output, auth, or config persistence: also `pnpm exec vp run build`, then drive the changed command with the `verify-putio-cli` skill, which sandboxes the binary against a fixture API.
- Standalone binary bundling: `pnpm exec vp run build:sea`, then `pnpm exec vp run verify:sea`.
Expand Down
7 changes: 5 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ in [AGENTS.md](AGENTS.md#proof).

## Effect Versions

Keep `effect` and every `@effect/*` package in [`package.json`](package.json) on
one exact version; Renovate's shared `effect` group moves them together. The
Keep `effect` and every `@effect/*` runtime and test package in
[`package.json`](package.json) on one exact version; Renovate's shared `effect`
group moves them together. `@effect/tsgo` versions separately and moves in its
own group, because each release supports a fixed set of Oxlint and TypeScript
versions. The
`@putdotio/sdk>effect` override in
[`pnpm-workspace.yaml`](https://github.com/putdotio/putio-cli/blob/main/pnpm-workspace.yaml)
holds the SDK on that version; `smoke:pack` fails if the packed install
Expand Down
2 changes: 1 addition & 1 deletion knip.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"$schema": "https://unpkg.com/knip@6/schema.json",
"entry": ["src/index.ts", "src/bin.ts", "src/sea.ts", ".agents/skills/*/scripts/*.mjs"],
"ignore": ["tools/oxlint/anti-slop/**"],
"ignoreDependencies": ["@effect/platform-node-shared", "postject"]
"ignoreDependencies": ["@effect/language-service", "@effect/platform-node-shared", "postject"]
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"scripts": {
"build": "vp pack",
"build:sea": "node ./scripts/build-sea.mts",
"check": "vp check .",
"check": "effect-tsgo vp check .",
"check:architecture": "node ./scripts/check-architecture.mts",
"check:dead-code": "knip",
"coverage": "vp test run --coverage",
Expand All @@ -46,7 +46,7 @@
"test": "vp test",
"prepublishOnly": "npm run build",
"verify:sea": "node ./scripts/verify-sea.mjs",
"verify": "node ./scripts/check-architecture.mts && knip && vp check . && vp run skills:lint && vp run smoke:pack && vp test run --coverage"
"verify": "node ./scripts/check-architecture.mts && knip && effect-tsgo vp check . && vp run skills:lint && vp run smoke:pack && vp test run --coverage"
},
"dependencies": {
"@effect/platform-node": "4.1.4",
Expand All @@ -57,6 +57,7 @@
"i18next": "^26.7.2"
},
"devDependencies": {
"@effect/tsgo": "0.68.1",
"@effect/vitest": "4.1.4",
"@oxlint/plugins": "1.91.0",
"@putdotio/sdk": "16.0.1",
Expand Down
73 changes: 73 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ allowBuilds:

minimumReleaseAgeExclude:
- "@putdotio/*"
- "@effect/tsgo"
- "@effect/tsgo-*"
catalog:
vite: npm:@voidzero-dev/vite-plus-core@1.5.0
vitest: 5.1.0
Expand Down
10 changes: 9 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": ["github>putdotio/.github:renovate-vite-plus"]
"extends": ["github>putdotio/.github:renovate-vite-plus"],
"packageRules": [
{
"description": "@effect/tsgo supports a fixed set of Oxlint and TypeScript versions, so it moves on its own instead of with the effect group",
"matchPackageNames": ["@effect/tsgo"],
"groupName": "effect-tsgo",
"groupSlug": "effect-tsgo"
}
]
}
2 changes: 1 addition & 1 deletion scripts/smoke-packed-install.mts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const UseResult = Schema.Struct({

const TransfersList = Schema.Struct({
cursor: Schema.NullOr(Schema.String),
total: Schema.Number,
total: Schema.Finite,
transfers: Schema.Array(Schema.Unknown),
});

Expand Down
2 changes: 1 addition & 1 deletion src/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ describe("cli argv parsing", () => {
profile: "automation",
});

const afterUse = Schema.decodeUnknownSync(PersistedProfileSelectionSchema)(
const afterUse = Schema.decodeSync(PersistedProfileSelectionSchema)(
await readFile(useResult.configPath, "utf8"),
);

Expand Down
8 changes: 6 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CliError, Command } from "effect/cli";
import { Console, Effect, Predicate, Result, type Scope } from "effect";
import { Console, Data, Effect, Predicate, Result, type Scope } from "effect";
import packageJson from "../package.json";

import { authCommand, rejectInlineAuthToken } from "./commands/auth.js";
Expand Down Expand Up @@ -159,6 +159,10 @@ type CliCommandEnvironment =
| CliState
| Scope.Scope;

class CliUsageError extends Data.TaggedError("CliUsageError")<{
readonly message: string;
}> {}

export const runCli: (
args: ReadonlyArray<string>,
) => Effect.Effect<void, unknown, CliCommandEnvironment> = Effect.fn("putio.cli.run")(function* (
Expand Down Expand Up @@ -199,7 +203,7 @@ export const runCli: (
return replayBufferedConsole(currentConsole, entries);
}

return Effect.fail(new Error(formatCliParserError(error)));
return Effect.fail(new CliUsageError({ message: formatCliParserError(error) }));
Comment thread
altaywtf marked this conversation as resolved.
Resolved
},
(error) => Effect.fail(error),
),
Expand Down
10 changes: 10 additions & 0 deletions src/command-paths.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ const expectFailure = (run: CliRun, message: string | RegExp) => {
expect(stderrJson(run).error).toMatchObject({
message: Predicate.isString(message) ? message : expect.stringMatching(message),
});
expect(run.crashReports).toEqual([]);
};

let api: FixtureApi;
Expand Down Expand Up @@ -781,6 +782,15 @@ describe("pagination", () => {
});
});

describe("download links", () => {
it("asks for a selection when download-links create has none", async () => {
const run = await putio("download-links", "create", "--output", "json");

expectFailure(run, "Provide at least one --id or a --cursor to create download links.");
expect(api.requests).toEqual([]);
});
});

describe("file writes", () => {
it("creates a folder", async () => {
api.route("POST /v2/files/create-folder", ok({ file: file(42, "Projects", { parent_id: 9 }) }));
Expand Down
Loading