sharepoint-cli-rs 0.0.14__tar.gz → 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/CHANGELOG.md +6 -0
  2. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/Cargo.lock +1 -1
  3. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/Cargo.toml +1 -1
  4. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/PKG-INFO +33 -2
  5. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/README.md +32 -1
  6. sharepoint_cli_rs-0.1.0/docs/releases.md +50 -0
  7. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/docs/testing.md +19 -0
  8. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/auth/mod.rs +1 -1
  9. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/cli.rs +27 -13
  10. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/commands/auth.rs +19 -5
  11. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/commands/drives.rs +14 -6
  12. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/commands/files.rs +54 -29
  13. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/commands/schema.rs +12 -2
  14. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/commands/sites.rs +9 -14
  15. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/error.rs +5 -2
  16. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/graph/drives.rs +2 -0
  17. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/graph/mod.rs +38 -13
  18. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/lib.rs +1 -0
  19. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/main.rs +76 -13
  20. sharepoint_cli_rs-0.1.0/src/pagination.rs +50 -0
  21. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/rest/mod.rs +9 -6
  22. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_auth_login_canonicalizes_tenant.rs +3 -8
  23. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_auth_logout.rs +3 -6
  24. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_auth_no_client_id.rs +3 -12
  25. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_auth_status.rs +2 -4
  26. sharepoint_cli_rs-0.1.0/tests/cmd_backend_contract.rs +388 -0
  27. sharepoint_cli_rs-0.1.0/tests/cmd_collection_pagination.rs +168 -0
  28. sharepoint_cli_rs-0.1.0/tests/cmd_download_safety.rs +329 -0
  29. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_drives_list.rs +3 -6
  30. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_drives_list_pagination.rs +3 -3
  31. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_files_find.rs +4 -5
  32. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_files_ls.rs +2 -4
  33. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_files_ls_pagination.rs +3 -1
  34. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_files_stat_download.rs +3 -6
  35. sharepoint_cli_rs-0.1.0/tests/cmd_flags.rs +119 -0
  36. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_init_quiet.rs +3 -7
  37. sharepoint_cli_rs-0.1.0/tests/cmd_pagination_safety.rs +120 -0
  38. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_profile.rs +3 -8
  39. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_rest_drives_list.rs +2 -2
  40. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_schema.rs +9 -28
  41. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_sites_list.rs +2 -4
  42. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_sites_use.rs +3 -7
  43. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/graph_page_token_host_validation.rs +3 -6
  44. sharepoint_cli_rs-0.1.0/tests/support/backend.rs +98 -0
  45. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/support/mod.rs +3 -0
  46. sharepoint_cli_rs-0.0.14/docs/releases.md +0 -38
  47. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/.envrc +0 -0
  48. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/.github/workflows/ci.yml +0 -0
  49. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/.github/workflows/clispec.yml +0 -0
  50. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/.github/workflows/dependencies.yml +0 -0
  51. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/.github/workflows/release.yml +0 -0
  52. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/.gitignore +0 -0
  53. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/.mise.toml +0 -0
  54. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/Makefile +0 -0
  55. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/docs/superpowers/.gitignore +0 -0
  56. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/examples/simulator/contracts/LICENSE.pnpcore +0 -0
  57. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/examples/simulator/contracts/README.md +0 -0
  58. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/examples/simulator/contracts/pnpcore.json +0 -0
  59. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/examples/simulator/contracts/provenance.json +0 -0
  60. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/examples/simulator/fixtures.json +0 -0
  61. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/examples/simulator/main.rs +0 -0
  62. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/examples/simulator/odata.rs +0 -0
  63. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/examples/simulator/recording.rs +0 -0
  64. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/examples/simulator/server.rs +0 -0
  65. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/examples/simulator/smoke.rs +0 -0
  66. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/flake.lock +0 -0
  67. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/flake.nix +0 -0
  68. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/nix/overlay-check.nix +0 -0
  69. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/nix/package.nix +0 -0
  70. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/prek.toml +0 -0
  71. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/pyproject.toml +0 -0
  72. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/scripts/import_pnpcore_contracts.py +0 -0
  73. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/sharepoint_cli/__init__.py +0 -0
  74. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/sharepoint_cli/__main__.py +0 -0
  75. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/sharepoint_cli/py.typed +0 -0
  76. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/auth/browser.rs +0 -0
  77. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/auth/device_code.rs +0 -0
  78. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/auth/session_store.rs +0 -0
  79. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/auth/token_cache.rs +0 -0
  80. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/backend.rs +0 -0
  81. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/commands/config.rs +0 -0
  82. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/commands/doctor.rs +0 -0
  83. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/commands/init.rs +0 -0
  84. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/commands/mod.rs +0 -0
  85. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/commands/profile.rs +0 -0
  86. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/config.rs +0 -0
  87. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/graph/download.rs +0 -0
  88. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/graph/search.rs +0 -0
  89. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/graph/sites.rs +0 -0
  90. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/output.rs +0 -0
  91. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/reference.rs +0 -0
  92. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/rest/download.rs +0 -0
  93. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/rest/drives.rs +0 -0
  94. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/rest/search.rs +0 -0
  95. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/rest/sites.rs +0 -0
  96. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/src/util.rs +0 -0
  97. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/auth_concurrent_refresh.rs +0 -0
  98. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/auth_refresh.rs +0 -0
  99. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/auth_token_retry.rs +0 -0
  100. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_auth_env_refresh_token.rs +0 -0
  101. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_auth_login_quiet_prompts.rs +0 -0
  102. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_clap_error_is_json.rs +0 -0
  103. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_config.rs +0 -0
  104. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_files_ls_recursive_rejects_pagination_flags.rs +0 -0
  105. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_rest_auth.rs +0 -0
  106. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_rest_files_find.rs +0 -0
  107. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_rest_files_ls.rs +0 -0
  108. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_rest_files_stat_download.rs +0 -0
  109. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/cmd_rest_sites_list.rs +0 -0
  110. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/device_code_polling.rs +0 -0
  111. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/fixtures/clispec-v0.3.json +0 -0
  112. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/graph_download.rs +0 -0
  113. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/graph_retry.rs +0 -0
  114. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/rest_client.rs +0 -0
  115. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/tests/simulator.rs +0 -0
  116. {sharepoint_cli_rs-0.0.14 → sharepoint_cli_rs-0.1.0}/vership.toml +0 -0
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/).
6
6
 
7
+ ## [0.1.0](https://github.com/rvben/sharepoint-cli/compare/v0.0.14...v0.1.0) - 2026-11-03
8
+
9
+ ### Added
10
+
11
+ - harden downloads and automation across platforms ([f89f433](https://github.com/rvben/sharepoint-cli/commit/f89f433e24a6bcc388d8fd89f0929244a178f430))
12
+
7
13
  ## [0.0.14](https://github.com/rvben/sharepoint-cli/compare/v0.0.13...v0.0.14) - 2026-11-03
8
14
 
9
15
  ### Added
@@ -1721,7 +1721,7 @@ dependencies = [
1721
1721
 
1722
1722
  [[package]]
1723
1723
  name = "sharepoint-cli"
1724
- version = "0.0.14"
1724
+ version = "0.1.0"
1725
1725
  dependencies = [
1726
1726
  "assert_cmd",
1727
1727
  "base64",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "sharepoint-cli"
3
- version = "0.0.14"
3
+ version = "0.1.0"
4
4
  edition = "2024"
5
5
  rust-version = "1.90"
6
6
  description = "Agent-friendly SharePoint Online CLI with JSON output, structured exit codes, and schema introspection"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sharepoint-cli-rs
3
- Version: 0.0.14
3
+ Version: 0.1.0
4
4
  Classifier: Development Status :: 3 - Alpha
5
5
  Classifier: Environment :: Console
6
6
  Classifier: Intended Audience :: System Administrators
@@ -118,7 +118,7 @@ sharepoint files ls <site>:<library>/
118
118
 
119
119
  # Stat / download / search
120
120
  sharepoint files stat <site>:<library>/path/to/file
121
- sharepoint files download <site>:<library>/path/to/file -o ./out.bin
121
+ sharepoint files download <site>:<library>/path/to/file --path ./out.bin
122
122
  sharepoint files find <site>:<library>/ --name '*.pdf'
123
123
  sharepoint doctor
124
124
  ```
@@ -143,6 +143,37 @@ input error instead.
143
143
  - `--json` (or non-TTY stdout) emits machine-readable JSON on stdout.
144
144
  - `--quiet` suppresses status messages.
145
145
  - `--no-color` and the standard `NO_COLOR` environment variable disable ANSI output.
146
+ - Errors go to stderr; JSON errors have the shape
147
+ `{"error":{"kind":"not_found","message":"…","exit_code":4}}`.
148
+ `--quiet` keeps errors visible. Exit codes are 0 (success), 1 (transport/local
149
+ failure), 2 (invalid input/read-only), 3 (authentication/access denied),
150
+ 4 (not found), 5 (API failure), 6 (rate limit), and 7 (conflict).
151
+
152
+ List responses contain `items`, `total`, and an opaque `next` cursor. Pass a
153
+ non-null cursor back with `--page`; stop when `next` is null. `--limit` must be
154
+ positive and sets an upper bound, so a server page or a search filtered by
155
+ `--name` can return fewer items. Use `--all` for sites, drives, file listings,
156
+ and search to fetch all remaining pages. `files ls --recursive` returns the
157
+ complete tree and cannot be combined with pagination flags.
158
+ For sites and files, `total` counts the returned items. For drives and Graph
159
+ cached accounts, it counts the complete collection before limiting.
160
+ Graph `auth status` supports `--limit` and `--page`; REST status describes a
161
+ single host session and rejects `--page`.
162
+
163
+ Downloads use `--path FILE`, with parent directories created as needed. A
164
+ completed transfer replaces an existing destination only with `--overwrite`;
165
+ transfer errors leave the destination file unchanged and remove their staging
166
+ file. Parent directories created for a download remain. Abrupt process termination
167
+ can leave a `.sharepoint-download-*` staging file beside the destination.
168
+ `--overwrite` replaces the file entry (including a symlink), rather than writing
169
+ through it; existing metadata and hard links are not preserved. On Unix,
170
+ downloaded files are private to their owner.
171
+ Without `--overwrite`, a file created during the transfer is also protected.
172
+ `--path -` writes raw file bytes to stdout, including in JSON mode; stream
173
+ failures can leave partial bytes on stdout, with the error on stderr.
174
+ The legacy `--output FILE` and `-o FILE` aliases work **after** `files download`.
175
+ Put the global `--output json|text|auto` **before** `files download`, and prefer
176
+ `--path` for an unambiguous destination.
146
177
 
147
178
  Suite-level discovery is available without guessing: use `sharepoint doctor --offline`, `sharepoint schema --command 'files stat'`, `sharepoint config show`, and `sharepoint completions <shell>`.
148
179
 
@@ -97,7 +97,7 @@ sharepoint files ls <site>:<library>/
97
97
 
98
98
  # Stat / download / search
99
99
  sharepoint files stat <site>:<library>/path/to/file
100
- sharepoint files download <site>:<library>/path/to/file -o ./out.bin
100
+ sharepoint files download <site>:<library>/path/to/file --path ./out.bin
101
101
  sharepoint files find <site>:<library>/ --name '*.pdf'
102
102
  sharepoint doctor
103
103
  ```
@@ -122,6 +122,37 @@ input error instead.
122
122
  - `--json` (or non-TTY stdout) emits machine-readable JSON on stdout.
123
123
  - `--quiet` suppresses status messages.
124
124
  - `--no-color` and the standard `NO_COLOR` environment variable disable ANSI output.
125
+ - Errors go to stderr; JSON errors have the shape
126
+ `{"error":{"kind":"not_found","message":"…","exit_code":4}}`.
127
+ `--quiet` keeps errors visible. Exit codes are 0 (success), 1 (transport/local
128
+ failure), 2 (invalid input/read-only), 3 (authentication/access denied),
129
+ 4 (not found), 5 (API failure), 6 (rate limit), and 7 (conflict).
130
+
131
+ List responses contain `items`, `total`, and an opaque `next` cursor. Pass a
132
+ non-null cursor back with `--page`; stop when `next` is null. `--limit` must be
133
+ positive and sets an upper bound, so a server page or a search filtered by
134
+ `--name` can return fewer items. Use `--all` for sites, drives, file listings,
135
+ and search to fetch all remaining pages. `files ls --recursive` returns the
136
+ complete tree and cannot be combined with pagination flags.
137
+ For sites and files, `total` counts the returned items. For drives and Graph
138
+ cached accounts, it counts the complete collection before limiting.
139
+ Graph `auth status` supports `--limit` and `--page`; REST status describes a
140
+ single host session and rejects `--page`.
141
+
142
+ Downloads use `--path FILE`, with parent directories created as needed. A
143
+ completed transfer replaces an existing destination only with `--overwrite`;
144
+ transfer errors leave the destination file unchanged and remove their staging
145
+ file. Parent directories created for a download remain. Abrupt process termination
146
+ can leave a `.sharepoint-download-*` staging file beside the destination.
147
+ `--overwrite` replaces the file entry (including a symlink), rather than writing
148
+ through it; existing metadata and hard links are not preserved. On Unix,
149
+ downloaded files are private to their owner.
150
+ Without `--overwrite`, a file created during the transfer is also protected.
151
+ `--path -` writes raw file bytes to stdout, including in JSON mode; stream
152
+ failures can leave partial bytes on stdout, with the error on stderr.
153
+ The legacy `--output FILE` and `-o FILE` aliases work **after** `files download`.
154
+ Put the global `--output json|text|auto` **before** `files download`, and prefer
155
+ `--path` for an unambiguous destination.
125
156
 
126
157
  Suite-level discovery is available without guessing: use `sharepoint doctor --offline`, `sharepoint schema --command 'files stat'`, `sharepoint config show`, and `sharepoint completions <shell>`.
127
158
 
@@ -0,0 +1,50 @@
1
+ # Releases
2
+
3
+ Vership is the release control plane for `sharepoint-cli`. GitHub Actions is the
4
+ execution plane for cross-platform builds, publication, provenance, and
5
+ downstream packaging.
6
+
7
+ ## Create a release
8
+
9
+ Start from a clean, up-to-date `main` branch and run:
10
+
11
+ ```sh
12
+ vership preflight
13
+ vership bump patch --prepare # or minor/major; creates the release commit locally
14
+ # After approval to push and publish:
15
+ vership release
16
+ # Wait for the tag's Release workflow to finish, then:
17
+ vership verify --targets tag,release,crates,pypi
18
+ ```
19
+
20
+ Before preparing, inspect `vership status`, `vership config show`, and the
21
+ installed command's `--help`. Preparation runs `make check`, updates the package
22
+ version and changelog, and creates the Conventional Commit release commit.
23
+ Review and test that commit, then use `vership release` to tag and push the
24
+ prepared version without bumping again. The tag starts the release workflow.
25
+ Publishing requires explicit approval; an instruction to release a named version
26
+ provides that authorization.
27
+
28
+ Wait for CI on Linux, macOS, and Windows and the publication workflow. Verify
29
+ all four targets, download a published binary, check its version and checksum,
30
+ and run `cargo run --example simulator -- smoke --cli /path/to/sharepoint`.
31
+ Finally fetch and fast-forward the primary checkout to the remote default branch,
32
+ confirming that the release tag and remote branch reference the tested commit.
33
+
34
+ Cargo and Python package versions are kept synchronized as one release unit.
35
+
36
+ ## Failure policy
37
+
38
+ If a release fails before any release, artifact, package, checksum, or
39
+ attestation becomes public, delete and recreate the brief tag and retry the
40
+ same version. Once anything was published, preserve the tag and issue a patch
41
+ release for release-content corrections. Registry and downstream-packaging
42
+ jobs are separate recovery domains; retry only the failed job when possible.
43
+
44
+ ## Dry runs
45
+
46
+ The Release workflow can be dispatched from `main` with `dry_run` enabled. It
47
+ uses the package version unless an explicit `version` is supplied, builds the
48
+ real artifacts, and exercises registry validation without publishing packages,
49
+ creating a GitHub release, generating attestations, or updating downstream
50
+ packaging.
@@ -7,6 +7,25 @@ integration tests on Linux, macOS, and Windows. The REST integration tests use
7
7
  local HTTP servers and temporary config/cache directories; they need no tenant,
8
8
  browser, or credentials.
9
9
 
10
+ All Graph command tests run on each platform too; only OS-specific permission
11
+ assertions are conditional. Shared CLI test helpers isolate config/cache files
12
+ and remove inherited SharePoint/Microsoft settings while keeping the operating
13
+ system environment, including Windows `SystemRoot`.
14
+
15
+ The release contract tests exercise both backends through the compiled CLI:
16
+
17
+ ```sh
18
+ cargo nextest run --test cmd_download_safety --test cmd_backend_contract \
19
+ --test cmd_collection_pagination --test cmd_flags --test cmd_pagination_safety
20
+ ```
21
+
22
+ They cover completed and interrupted binary downloads, preservation of existing
23
+ files, concurrent destination creation, cleanup, raw stdout, legacy flags,
24
+ JSON/text/quiet behavior, structured errors and exit codes, positive limits,
25
+ page boundaries, account/library cursors, foreign origins, and continuation loops.
26
+ A small real HTTP peer closes a response before its declared content length to
27
+ exercise mid-stream failures; other API scenarios use local HTTP mocks.
28
+
10
29
  To run just the REST tests and the config-directory regression test:
11
30
 
12
31
  ```sh
@@ -1,4 +1,4 @@
1
- //! Authentication subsystem (device-code flow only in v0.1).
1
+ //! Authentication: Graph device-code flow and SharePoint REST browser sessions.
2
2
  //!
3
3
  //! `AuthContext` is the runtime entrypoint: every Graph call goes through
4
4
  //! `access_token()`, which automatically refreshes when the cached token is
@@ -61,6 +61,16 @@ pub struct Cli {
61
61
  pub command: Command,
62
62
  }
63
63
 
64
+ impl Cli {
65
+ pub fn output_format(&self) -> OutputFormat {
66
+ if self.json && self.output == OutputFormat::Auto {
67
+ OutputFormat::Json
68
+ } else {
69
+ self.output
70
+ }
71
+ }
72
+ }
73
+
64
74
  #[derive(Debug, Subcommand)]
65
75
  pub enum Command {
66
76
  /// Configure a profile and optionally sign in (device code for graph, browser for rest).
@@ -111,7 +121,7 @@ pub enum AuthCmd {
111
121
  #[arg(long)]
112
122
  offline: bool,
113
123
  /// Maximum number of accounts to show (graph backend only).
114
- #[arg(long, default_value_t = 50)]
124
+ #[arg(long, default_value_t = 50, value_parser = positive_limit)]
115
125
  limit: usize,
116
126
  /// Opaque pagination cursor from a previous response's `next` field.
117
127
  #[arg(long)]
@@ -161,7 +171,7 @@ pub enum SitesCmd {
161
171
  List {
162
172
  #[arg(long)]
163
173
  query: Option<String>,
164
- #[arg(long, default_value_t = 50)]
174
+ #[arg(long, default_value_t = 50, value_parser = positive_limit)]
165
175
  limit: usize,
166
176
  #[arg(long)]
167
177
  all: bool,
@@ -183,10 +193,13 @@ pub enum DrivesCmd {
183
193
  /// List drives (libraries) for a site reference.
184
194
  List {
185
195
  site: String,
186
- #[arg(long, default_value_t = 50)]
196
+ #[arg(long, default_value_t = 50, value_parser = positive_limit)]
187
197
  limit: usize,
188
198
  #[arg(long)]
189
199
  all: bool,
200
+ /// Opaque pagination cursor from a previous response's `next` field.
201
+ #[arg(long)]
202
+ page: Option<String>,
190
203
  /// Comma-separated output fields to include (e.g. id,name,drive_type).
191
204
  #[arg(long, value_delimiter = ',')]
192
205
  fields: Vec<String>,
@@ -201,7 +214,7 @@ pub enum FilesCmd {
201
214
  reference: String,
202
215
  #[arg(short = 'r', long)]
203
216
  recursive: bool,
204
- #[arg(long)]
217
+ #[arg(long, value_parser = positive_limit)]
205
218
  limit: Option<usize>,
206
219
  #[arg(long)]
207
220
  all: bool,
@@ -234,7 +247,7 @@ pub enum FilesCmd {
234
247
  query: Option<String>,
235
248
  #[arg(long)]
236
249
  name: Option<String>,
237
- #[arg(long, default_value_t = 200)]
250
+ #[arg(long, default_value_t = 200, value_parser = positive_limit)]
238
251
  limit: usize,
239
252
  #[arg(long)]
240
253
  all: bool,
@@ -271,14 +284,7 @@ impl Runtime {
271
284
  let cache_path = config::token_cache_path()?;
272
285
  let session_path = config::session_store_path()?;
273
286
  Ok(Self {
274
- out: OutputConfig::new(
275
- if cli.json && cli.output == OutputFormat::Auto {
276
- OutputFormat::Json
277
- } else {
278
- cli.output
279
- },
280
- cli.quiet,
281
- ),
287
+ out: OutputConfig::new(cli.output_format(), cli.quiet),
282
288
  cfg,
283
289
  config_file,
284
290
  config_path,
@@ -311,3 +317,11 @@ pub async fn run(cli: Cli) -> Result<()> {
311
317
  Command::Doctor { offline } => crate::commands::doctor::run(&rt, offline).await,
312
318
  }
313
319
  }
320
+
321
+ fn positive_limit(value: &str) -> std::result::Result<usize, String> {
322
+ value
323
+ .parse::<usize>()
324
+ .ok()
325
+ .filter(|n| *n > 0)
326
+ .ok_or_else(|| "limit must be a positive integer".to_owned())
327
+ }
@@ -18,9 +18,19 @@ pub async fn run(rt: &Runtime, cmd: AuthCmd) -> Result<()> {
18
18
  (
19
19
  BackendKind::Rest,
20
20
  AuthCmd::Status {
21
- offline, fields, ..
21
+ offline,
22
+ fields,
23
+ page,
24
+ ..
22
25
  },
23
- ) => rest_status(rt, offline, &fields).await,
26
+ ) => {
27
+ if page.is_some() {
28
+ return Err(CliError::Input(
29
+ "auth status --page is only available for Graph accounts".into(),
30
+ ));
31
+ }
32
+ rest_status(rt, offline, &fields).await
33
+ }
24
34
  (BackendKind::Graph, AuthCmd::Login) => login(rt).await,
25
35
  (BackendKind::Graph, AuthCmd::Logout) => logout(rt).await,
26
36
  (
@@ -140,9 +150,11 @@ async fn status(
140
150
  rt: &Runtime,
141
151
  offline: bool,
142
152
  limit: usize,
143
- _page: Option<&str>,
153
+ page: Option<&str>,
144
154
  fields: &[String],
145
155
  ) -> Result<()> {
156
+ let scope = format!("accounts:{}", rt.cfg.profile_name);
157
+ let offset = crate::pagination::offset(page, &scope)?;
146
158
  let cache = token_cache::load(&rt.cache_path)?;
147
159
 
148
160
  // Build the full account list.
@@ -169,7 +181,9 @@ async fn status(
169
181
  .collect();
170
182
 
171
183
  let total = all_accounts.len();
172
- all_accounts.truncate(limit);
184
+ let all_accounts: Vec<_> = all_accounts.drain(..).skip(offset).take(limit).collect();
185
+ let next =
186
+ crate::pagination::next_offset(&scope, offset.saturating_add(all_accounts.len()), total);
173
187
  let identity = if offline || total == 0 {
174
188
  None
175
189
  } else {
@@ -183,7 +197,7 @@ async fn status(
183
197
  if rt.out.json {
184
198
  rt.out.print_json(&serde_json::json!({
185
199
  "total": total,
186
- "next": serde_json::Value::Null,
200
+ "next": next,
187
201
  "items": all_accounts,
188
202
  "verified": identity.is_some(),
189
203
  "identity": identity,
@@ -11,8 +11,9 @@ pub async fn run(rt: &Runtime, cmd: DrivesCmd) -> Result<()> {
11
11
  site,
12
12
  limit,
13
13
  all,
14
+ page,
14
15
  fields,
15
- } => list(rt, &site, limit, all, &fields).await,
16
+ } => list(rt, &site, limit, all, page.as_deref(), &fields).await,
16
17
  }
17
18
  }
18
19
 
@@ -21,6 +22,7 @@ async fn list(
21
22
  site_input: &str,
22
23
  limit: usize,
23
24
  all: bool,
25
+ page: Option<&str>,
24
26
  fields: &[String],
25
27
  ) -> Result<()> {
26
28
  let backend = Backend::from_runtime(rt)?;
@@ -53,11 +55,17 @@ async fn list(
53
55
  rt.cfg.default_site.as_deref(),
54
56
  )
55
57
  .await?;
56
- let mut all_drives = backend.list_drives(&site).await?;
58
+ let scope = format!("drives:{:?}:{}", rt.cfg.backend, site.web_url);
59
+ let offset = crate::pagination::offset(page, &scope)?;
60
+ let all_drives = backend.list_drives(&site).await?;
57
61
  let total = all_drives.len();
58
- if !all && all_drives.len() > limit {
59
- all_drives.truncate(limit);
60
- }
62
+ let all_drives: Vec<_> = all_drives
63
+ .into_iter()
64
+ .skip(offset)
65
+ .take(if all { usize::MAX } else { limit })
66
+ .collect();
67
+ let next =
68
+ crate::pagination::next_offset(&scope, offset.saturating_add(all_drives.len()), total);
61
69
 
62
70
  if rt.out.json {
63
71
  let items: Vec<_> = all_drives
@@ -76,7 +84,7 @@ async fn list(
76
84
  .collect();
77
85
  rt.out.print_json(&serde_json::json!({
78
86
  "total": total,
79
- "next": null,
87
+ "next": next,
80
88
  "items": items,
81
89
  }));
82
90
  } else {
@@ -8,7 +8,7 @@ use crate::cli::{FilesCmd, Runtime};
8
8
  use crate::error::{CliError, Result};
9
9
  use crate::graph::drives::{Drive, canonical_json};
10
10
  use crate::graph::sites::Site;
11
- use crate::graph::{Cursor, decode_cursor, encode_cursor};
11
+ use crate::graph::{decode_cursor, encode_cursor, page_cursor};
12
12
  use crate::output::terminal_width;
13
13
  use crate::reference::{ParsedRef, parse};
14
14
 
@@ -190,10 +190,12 @@ async fn ls(
190
190
 
191
191
  let mut items: Vec<_> = Vec::new();
192
192
 
193
- let out_cursor: Option<Cursor> = 'outer: loop {
193
+ let mut seen = std::collections::HashSet::new();
194
+ let out_cursor = 'outer: loop {
194
195
  let pageres = backend
195
196
  .list_children(&r.site, &r.drive, &r.parsed.path, current_url.as_deref())
196
197
  .await?;
198
+ crate::pagination::record_page(&mut seen, &pageres.fetched_url)?;
197
199
 
198
200
  for (idx, it) in pageres.items.iter().enumerate() {
199
201
  if idx < skip {
@@ -201,24 +203,18 @@ async fn ls(
201
203
  }
202
204
  items.push(it.clone());
203
205
  if !all && items.len() >= effective_limit {
204
- // Mid-page: point the cursor back at the same page with updated skip.
205
- let consumed_in_page = idx + 1;
206
- break 'outer Some(Cursor {
207
- next: Some(pageres.fetched_url),
208
- skip: consumed_in_page,
209
- });
206
+ break 'outer page_cursor(
207
+ &pageres.fetched_url,
208
+ pageres.next_url,
209
+ idx + 1,
210
+ pageres.items.len(),
211
+ );
210
212
  }
211
213
  }
212
214
  skip = 0;
213
215
 
214
216
  match pageres.next_url {
215
217
  None => break None,
216
- Some(url) if !all && items.len() >= effective_limit => {
217
- break Some(Cursor {
218
- next: Some(url),
219
- skip: 0,
220
- });
221
- }
222
218
  Some(url) => current_url = Some(url),
223
219
  }
224
220
  };
@@ -281,7 +277,7 @@ async fn download(
281
277
  ) -> Result<()> {
282
278
  let (backend, r) = resolve(rt, reference).await?;
283
279
 
284
- // Derive the target filename from the path when --output is not given.
280
+ // Derive the target filename when --path is not given.
285
281
  let derived;
286
282
  let target: &str = match output {
287
283
  Some(o) => o,
@@ -323,13 +319,44 @@ async fn download(
323
319
  })?;
324
320
  }
325
321
 
326
- let mut file = File::create(path)
327
- .await
328
- .map_err(|e| CliError::Other(format!("create '{target}': {e}")))?;
329
-
322
+ // Stage beside the destination so committing the completed download stays
323
+ // on the same filesystem. Dropping the tempfile cleans up failed transfers.
324
+ let parent = path
325
+ .parent()
326
+ .filter(|p| !p.as_os_str().is_empty())
327
+ .unwrap_or_else(|| std::path::Path::new("."));
328
+ let staged = tempfile::Builder::new()
329
+ .prefix(".sharepoint-download-")
330
+ .tempfile_in(parent)
331
+ .map_err(|e| CliError::Other(format!("stage download for '{target}': {e}")))?;
332
+ let mut file = File::from_std(
333
+ staged
334
+ .reopen()
335
+ .map_err(|e| CliError::Other(format!("open staged download: {e}")))?,
336
+ );
330
337
  let n = backend
331
338
  .download_to_writer(&r.site, &r.drive, &r.parsed.path, &mut file)
332
339
  .await?;
340
+ file.sync_all()
341
+ .await
342
+ .map_err(|e| CliError::Other(format!("sync download: {e}")))?;
343
+ drop(file);
344
+ // persist_noclobber also protects files created while the transfer ran;
345
+ // an existence check alone would allow a race to overwrite user data.
346
+ let committed = if overwrite {
347
+ staged.persist(path)
348
+ } else {
349
+ staged.persist_noclobber(path)
350
+ };
351
+ committed.map_err(|e| {
352
+ if !overwrite && e.error.kind() == std::io::ErrorKind::AlreadyExists {
353
+ CliError::Input(format!(
354
+ "'{target}' already exists; use --overwrite to replace it"
355
+ ))
356
+ } else {
357
+ CliError::Other(format!("save download to '{target}': {}", e.error))
358
+ }
359
+ })?;
333
360
  rt.out
334
361
  .print_message(&format!("Downloaded {n} byte(s) to {}", path.display()));
335
362
  if rt.out.json {
@@ -369,8 +396,10 @@ async fn find(
369
396
 
370
397
  let mut items = Vec::new();
371
398
 
372
- let out_cursor: Option<Cursor> = 'outer: loop {
399
+ let mut seen = std::collections::HashSet::new();
400
+ let out_cursor = 'outer: loop {
373
401
  let res = backend.search(&r.drive, q, current_url.as_deref()).await?;
402
+ crate::pagination::record_page(&mut seen, &res.fetched_url)?;
374
403
 
375
404
  for (idx, it) in res.items.iter().enumerate() {
376
405
  if idx < skip {
@@ -389,22 +418,18 @@ async fn find(
389
418
  // relies on the glob filter being stateless: re-applying it to the same
390
419
  // items on the resumed page yields identical filter decisions, so no item
391
420
  // is double-emitted or skipped.
392
- let consumed_raw = idx + 1;
393
- break 'outer Some(Cursor {
394
- next: Some(res.fetched_url),
395
- skip: consumed_raw,
396
- });
421
+ break 'outer page_cursor(&res.fetched_url, res.next_url, idx + 1, res.items.len());
397
422
  }
398
423
  }
399
424
  skip = 0;
400
425
 
401
426
  if all {
402
- if res.next_url.is_none() {
403
- break None;
427
+ match res.next_url {
428
+ Some(url) => current_url = Some(url),
429
+ None => break None,
404
430
  }
405
- current_url = res.next_url;
406
431
  } else {
407
- break res.next_url.map(|url| Cursor {
432
+ break res.next_url.map(|url| crate::graph::Cursor {
408
433
  next: Some(url),
409
434
  skip: 0,
410
435
  });
@@ -102,7 +102,7 @@ pub fn run(command_filter: Option<&str>) -> crate::error::Result<()> {
102
102
  "args": [
103
103
  {"name": "--offline", "type": "boolean", "required": false, "default": false, "description": "Inspect cached credentials without contacting SharePoint or Microsoft Graph."},
104
104
  {"name": "--limit", "type": "integer", "required": false, "default": 50, "description": "Maximum number of accounts to show (graph backend only)."},
105
- {"name": "--page", "type": "string", "required": false, "description": "Opaque pagination cursor from a previous response's `next` field."},
105
+ {"name": "--page", "type": "string", "required": false, "description": "Opaque pagination cursor from a previous response's `next` field (Graph accounts only)."},
106
106
  {"name": "--fields", "type": "string[]", "required": false, "description": "Comma-separated item fields to include (e.g. username,expires_at; rest backend: host,username,captured_at)."}
107
107
  ],
108
108
  "output_fields": [
@@ -263,6 +263,7 @@ pub fn run(command_filter: Option<&str>) -> crate::error::Result<()> {
263
263
  {"name": "site", "type": "string", "required": true, "description": "Site reference: URL, spo://SiteName, or 'default'."},
264
264
  {"name": "--limit", "type": "integer", "required": false, "default": 50, "description": "Maximum number of items to return."},
265
265
  {"name": "--all", "type": "boolean", "required": false, "default": false, "description": "Return all drives (ignores --limit)."},
266
+ {"name": "--page", "type": "string", "required": false, "description": "Opaque pagination cursor from a previous response's `next` field."},
266
267
  {"name": "--fields", "type": "string[]", "required": false, "description": "Comma-separated fields to include in each item (e.g. id,name,drive_type)."}
267
268
  ],
268
269
  "output_fields": [
@@ -517,7 +518,7 @@ fn enrich_v0_3(schema: &mut Value) {
517
518
 
518
519
  let unbounded = matches!(
519
520
  name.as_str(),
520
- "auth status" | "sites list" | "files ls" | "files find"
521
+ "auth status" | "sites list" | "drives list" | "files ls" | "files find"
521
522
  );
522
523
  object.insert(
523
524
  "cardinality".into(),
@@ -542,6 +543,15 @@ fn enrich_v0_3(schema: &mut Value) {
542
543
  object.insert("example".into(), json!({"args":["config","show"]}));
543
544
  }
544
545
 
546
+ if let Some(args) = object.get_mut("args").and_then(Value::as_array_mut) {
547
+ for arg in args {
548
+ if arg["name"] == "--limit" {
549
+ let description = arg["description"].as_str().unwrap_or("");
550
+ arg["description"] =
551
+ json!(format!("{description} Must be a positive integer."));
552
+ }
553
+ }
554
+ }
545
555
  if let Some(fields) = object
546
556
  .get_mut("output_fields")
547
557
  .and_then(Value::as_array_mut)
@@ -4,7 +4,7 @@ use crate::backend::Backend;
4
4
  use crate::cli::{Runtime, SitesCmd};
5
5
  use crate::config;
6
6
  use crate::error::{CliError, Result};
7
- use crate::graph::{Cursor, decode_cursor, encode_cursor, sites};
7
+ use crate::graph::{decode_cursor, encode_cursor, page_cursor, sites};
8
8
 
9
9
  pub async fn run(rt: &Runtime, cmd: SitesCmd) -> Result<()> {
10
10
  match cmd {
@@ -41,8 +41,10 @@ async fn list(
41
41
  let mut items = Vec::new();
42
42
  let mut source_label: &str;
43
43
 
44
- let out_cursor: Option<Cursor> = 'outer: loop {
44
+ let mut seen = std::collections::HashSet::new();
45
+ let out_cursor = 'outer: loop {
45
46
  let res = backend.list_sites(query, current_url.as_deref()).await?;
47
+ crate::pagination::record_page(&mut seen, &res.fetched_url)?;
46
48
  source_label = match res.source {
47
49
  sites::SiteListSource::Followed => "followed",
48
50
  sites::SiteListSource::Search => "search",
@@ -54,25 +56,18 @@ async fn list(
54
56
  }
55
57
  items.push(s.clone());
56
58
  if !all && items.len() >= limit {
57
- // Mid-page: cursor points back at the same URL with updated skip.
58
- let consumed_in_page = idx + 1;
59
- break 'outer Some(Cursor {
60
- next: Some(res.fetched_url),
61
- skip: consumed_in_page,
62
- });
59
+ break 'outer page_cursor(&res.fetched_url, res.next_url, idx + 1, res.items.len());
63
60
  }
64
61
  }
65
62
  skip = 0;
66
63
 
67
64
  if all {
68
- if res.next_url.is_none() {
69
- // Exhausted.
70
- break None;
65
+ match res.next_url {
66
+ Some(url) => current_url = Some(url),
67
+ None => break None,
71
68
  }
72
- current_url = res.next_url;
73
69
  } else {
74
- // Not --all: emit next cursor pointing at the Graph nextLink.
75
- break res.next_url.map(|url| Cursor {
70
+ break res.next_url.map(|url| crate::graph::Cursor {
76
71
  next: Some(url),
77
72
  skip: 0,
78
73
  });