@artifactshare/cli 0.9.0 → 0.10.2

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,20 @@
3
3
  All notable changes to `@artifactshare/cli` are documented here.
4
4
  For user-facing announcements, see https://artifactshare.com/updates?product=cli.
5
5
 
6
+ ## Unreleased
7
+
8
+ ## 0.10.2 - 2026-08-09
9
+
10
+ - Rotate device-login refresh credentials after use and revoke their credential family during `logout`; a failed remote revoke now leaves the local credential intact.
11
+
12
+ ## 0.10.1 - 2026-08-09
13
+
14
+ - Publish the first npm release covered by the Artifact Share source-available license.
15
+
16
+ ## 0.10.0 - 2026-08-07
17
+
18
+ - Switch the repository and CLI license to the source-available license. Version 0.10.0 is not published to npm.
19
+
6
20
  ## 0.9.0 - 2026-08-05
7
21
 
8
22
  - `artifacts list --project-id` now lists every artifact you can view in the project, including other members' uploads, with `owner_email`; continue past 50 items with `--cursor`.
package/LICENSE CHANGED
@@ -1,202 +1,117 @@
1
+ # Artifact Share Source-Available License
1
2
 
2
- Apache License
3
- Version 2.0, January 2004
4
- http://www.apache.org/licenses/
5
-
6
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
-
8
- 1. Definitions.
9
-
10
- "License" shall mean the terms and conditions for use, reproduction,
11
- and distribution as defined by Sections 1 through 9 of this document.
12
-
13
- "Licensor" shall mean the copyright owner or entity authorized by
14
- the copyright owner that is granting the License.
15
-
16
- "Legal Entity" shall mean the union of the acting entity and all
17
- other entities that control, are controlled by, or are under common
18
- control with that entity. For the purposes of this definition,
19
- "control" means (i) the power, direct or indirect, to cause the
20
- direction or management of such entity, whether by contract or
21
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
- outstanding shares, or (iii) beneficial ownership of such entity.
23
-
24
- "You" (or "Your") shall mean an individual or Legal Entity
25
- exercising permissions granted by this License.
26
-
27
- "Source" form shall mean the preferred form for making modifications,
28
- including but not limited to software source code, documentation
29
- source, and configuration files.
30
-
31
- "Object" form shall mean any form resulting from mechanical
32
- transformation or translation of a Source form, including but
33
- not limited to compiled object code, generated documentation,
34
- and conversions to other media types.
35
-
36
- "Work" shall mean the work of authorship, whether in Source or
37
- Object form, made available under the License, as indicated by a
38
- copyright notice that is included in or attached to the work
39
- (an example is provided in the Appendix below).
40
-
41
- "Derivative Works" shall mean any work, whether in Source or Object
42
- form, that is based on (or derived from) the Work and for which the
43
- editorial revisions, annotations, elaborations, or other modifications
44
- represent, as a whole, an original work of authorship. For the purposes
45
- of this License, Derivative Works shall not include works that remain
46
- separable from, or merely link (or bind by name) to the interfaces of,
47
- the Work and Derivative Works thereof.
48
-
49
- "Contribution" shall mean any work of authorship, including
50
- the original version of the Work and any modifications or additions
51
- to that Work or Derivative Works thereof, that is intentionally
52
- submitted to Licensor for inclusion in the Work by the copyright owner
53
- or by an individual or Legal Entity authorized to submit on behalf of
54
- the copyright owner. For the purposes of this definition, "submitted"
55
- means any form of electronic, verbal, or written communication sent
56
- to the Licensor or its representatives, including but not limited to
57
- communication on electronic mailing lists, source code control systems,
58
- and issue tracking systems that are managed by, or on behalf of, the
59
- Licensor for the purpose of discussing and improving the Work, but
60
- excluding communication that is conspicuously marked or otherwise
61
- designated in writing by the copyright owner as "Not a Contribution."
62
-
63
- "Contributor" shall mean Licensor and any individual or Legal Entity
64
- on behalf of whom a Contribution has been received by Licensor and
65
- subsequently incorporated within the Work.
66
-
67
- 2. Grant of Copyright License. Subject to the terms and conditions of
68
- this License, each Contributor hereby grants to You a perpetual,
69
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
- copyright license to reproduce, prepare Derivative Works of,
71
- publicly display, publicly perform, sublicense, and distribute the
72
- Work and such Derivative Works in Source or Object form.
73
-
74
- 3. Grant of Patent License. Subject to the terms and conditions of
75
- this License, each Contributor hereby grants to You a perpetual,
76
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
- (except as stated in this section) patent license to make, have made,
78
- use, offer to sell, sell, import, and otherwise transfer the Work,
79
- where such license applies only to those patent claims licensable
80
- by such Contributor that are necessarily infringed by their
81
- Contribution(s) alone or by combination of their Contribution(s)
82
- with the Work to which such Contribution(s) was submitted. If You
83
- institute patent litigation against any entity (including a
84
- cross-claim or counterclaim in a lawsuit) alleging that the Work
85
- or a Contribution incorporated within the Work constitutes direct
86
- or contributory patent infringement, then any patent licenses
87
- granted to You under this License for that Work shall terminate
88
- as of the date such litigation is filed.
89
-
90
- 4. Redistribution. You may reproduce and distribute copies of the
91
- Work or Derivative Works thereof in any medium, with or without
92
- modifications, and in Source or Object form, provided that You
93
- meet the following conditions:
94
-
95
- (a) You must give any other recipients of the Work or
96
- Derivative Works a copy of this License; and
97
-
98
- (b) You must cause any modified files to carry prominent notices
99
- stating that You changed the files; and
100
-
101
- (c) You must retain, in the Source form of any Derivative Works
102
- that You distribute, all copyright, patent, trademark, and
103
- attribution notices from the Source form of the Work,
104
- excluding those notices that do not pertain to any part of
105
- the Derivative Works; and
106
-
107
- (d) If the Work includes a "NOTICE" text file as part of its
108
- distribution, then any Derivative Works that You distribute must
109
- include a readable copy of the attribution notices contained
110
- within such NOTICE file, excluding those notices that do not
111
- pertain to any part of the Derivative Works, in at least one
112
- of the following places: within a NOTICE text file distributed
113
- as part of the Derivative Works; within the Source form or
114
- documentation, if provided along with the Derivative Works; or,
115
- within a display generated by the Derivative Works, if and
116
- wherever such third-party notices normally appear. The contents
117
- of the NOTICE file are for informational purposes only and
118
- do not modify the License. You may add Your own attribution
119
- notices within Derivative Works that You distribute, alongside
120
- or as an addendum to the NOTICE text from the Work, provided
121
- that such additional attribution notices cannot be construed
122
- as modifying the License.
123
-
124
- You may add Your own copyright statement to Your modifications and
125
- may provide additional or different license terms and conditions
126
- for use, reproduction, or distribution of Your modifications, or
127
- for any such Derivative Works as a whole, provided Your use,
128
- reproduction, and distribution of the Work otherwise complies with
129
- the conditions stated in this License.
130
-
131
- 5. Submission of Contributions. Unless You explicitly state otherwise,
132
- any Contribution intentionally submitted for inclusion in the Work
133
- by You to the Licensor shall be under the terms and conditions of
134
- this License, without any additional terms or conditions.
135
- Notwithstanding the above, nothing herein shall supersede or modify
136
- the terms of any separate license agreement you may have executed
137
- with Licensor regarding such Contributions.
138
-
139
- 6. Trademarks. This License does not grant permission to use the trade
140
- names, trademarks, service marks, or product names of the Licensor,
141
- except as required for reasonable and customary use in describing the
142
- origin of the Work and reproducing the content of the NOTICE file.
143
-
144
- 7. Disclaimer of Warranty. Unless required by applicable law or
145
- agreed to in writing, Licensor provides the Work (and each
146
- Contributor provides its Contributions) on an "AS IS" BASIS,
147
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
- implied, including, without limitation, any warranties or conditions
149
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
- PARTICULAR PURPOSE. You are solely responsible for determining the
151
- appropriateness of using or redistributing the Work and assume any
152
- risks associated with Your exercise of permissions under this License.
153
-
154
- 8. Limitation of Liability. In no event and under no legal theory,
155
- whether in tort (including negligence), contract, or otherwise,
156
- unless required by applicable law (such as deliberate and grossly
157
- negligent acts) or agreed to in writing, shall any Contributor be
158
- liable to You for damages, including any direct, indirect, special,
159
- incidental, or consequential damages of any character arising as a
160
- result of this License or out of the use or inability to use the
161
- Work (including but not limited to damages for loss of goodwill,
162
- work stoppage, computer failure or malfunction, or any and all
163
- other commercial damages or losses), even if such Contributor
164
- has been advised of the possibility of such damages.
165
-
166
- 9. Accepting Warranty or Additional Liability. While redistributing
167
- the Work or Derivative Works thereof, You may choose to offer,
168
- and charge a fee for, acceptance of support, warranty, indemnity,
169
- or other liability obligations and/or rights consistent with this
170
- License. However, in accepting such obligations, You may act only
171
- on Your own behalf and on Your sole responsibility, not on behalf
172
- of any other Contributor, and only if You agree to indemnify,
173
- defend, and hold each Contributor harmless for any liability
174
- incurred by, or claims asserted against, such Contributor by reason
175
- of your accepting any such warranty or additional liability.
176
-
177
- END OF TERMS AND CONDITIONS
178
-
179
- APPENDIX: How to apply the Apache License to your work.
180
-
181
- To apply the Apache License to your work, attach the following
182
- boilerplate notice, with the fields enclosed by brackets "[]"
183
- replaced with your own identifying information. (Don't include
184
- the brackets!) The text should be enclosed in the appropriate
185
- comment syntax for the file format. We also recommend that a
186
- file or class name and description of purpose be included on the
187
- same "printed page" as the copyright notice for easier
188
- identification within third-party archives.
189
-
190
- Copyright [yyyy] [name of copyright owner]
191
-
192
- Licensed under the Apache License, Version 2.0 (the "License");
193
- you may not use this file except in compliance with the License.
194
- You may obtain a copy of the License at
195
-
196
- http://www.apache.org/licenses/LICENSE-2.0
197
-
198
- Unless required by applicable law or agreed to in writing, software
199
- distributed under the License is distributed on an "AS IS" BASIS,
200
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
- See the License for the specific language governing permissions and
202
- limitations under the License.
3
+ Copyright © 2026 TechTalk, Inc.
4
+
5
+ 日本語版を正本とし、後半の英語版は参考訳です。
6
+
7
+ ## 日本語版(正本)
8
+
9
+ ### 1. 定義と適用範囲
10
+
11
+ 「本ソフトウェア」とは、このライセンスが添付された Artifact Share のソフトウェアおよび関連文書をいいます。`packages/cli/` 配下の `@artifactshare/cli` を含みます。
12
+
13
+ 「ライセンサー」とは TechTalk, Inc. をいいます。「利用者」とは、本ソフトウェアのコピーを取得し、本ライセンスに基づく権利を行使する個人または法人をいいます。
14
+
15
+ ### 2. 許諾
16
+
17
+ 本ライセンスの条件に従うことを条件として、本ソフトウェアを無償で使用、複製、改変、統合、公開、配布、サブライセンス、および販売し、また、本ソフトウェアを提供された者にこれらを許可する権利を、利用者に付与します。
18
+
19
+ ### 3. 表示の保持
20
+
21
+ 上記の著作権表示および本ライセンスの全文を、本ソフトウェアのすべてのコピーまたは重要な部分に含めなければなりません。
22
+
23
+ ### 4. 競合サービスとしての提供の制限
24
+
25
+ 利用者および下流の受領者は、本ソフトウェアの機能そのものを主な価値とし、ライセンサーと直接競合するホスト型、マネージド型、SaaS、またはクラウドサービスとして、本ソフトウェア(改変版や派生版を含みます)を第三者へ提供してはなりません。第2条のサブライセンスまたは販売の許諾は、この制限を回避する権利を与えるものではありません。
26
+
27
+ 次の利用は、この条項だけを理由として禁止されません。
28
+
29
+ - 組織が自らの業務のために運用する self-hosting
30
+ - ベンダーが単一の顧客専用環境を導入し、保守すること。ただし、そのベンダーが自ら複数の顧客向けに競合サービスを提供しない場合に限ります
31
+ - Artifact Share の機能そのものが主な価値ではない別の製品またはサービスへの組み込み
32
+
33
+ 本条で制限される用途については、`support@artifactshare.com` へ商用ライセンスをお問い合わせください。
34
+
35
+ ### 5. 名称および商標
36
+
37
+ 本ライセンスは、Artifact Share の名称、ロゴ、サービスマークその他の商標に関する権利を付与しません。出所を事実に即して説明するため、または本ソフトウェアに同梱された未改変のブランド資産を本ソフトウェアとともに再配布するために必要な範囲でのみ、これらを使用できます。公式版、ライセンサーによる承認、提携、または後援があるとの誤認を招く使用はできません。
38
+
39
+ ### 6. Proposal および Contribution
40
+
41
+ proposal その他の投稿物の著作権は投稿者に留保されます。投稿者は、ライセンサーおよび本ソフトウェアの maintainer に対し、投稿物を評価、採択、本ソフトウェアへ組み込み、改変、複製、公開、および配布するために必要な、全世界的、非独占的、無償かつサブライセンス可能な許諾を付与します。
42
+
43
+ この条項は、現在 code contribution を募集するものではありません。将来 code contribution を受け付ける場合の許諾条件や contributor agreement は、別途定めます。
44
+
45
+ ### 7. 終了
46
+
47
+ 利用者が本ライセンスの条件に違反した場合、本ライセンスに基づく権利は終了します。違反を知ってから30日以内に違反をすべて是正した場合、権利は最初の違反について自動的に回復します。回復しない場合や違反が繰り返された場合に権利を回復するには、ライセンサーの書面による承諾が必要です。
48
+
49
+ ### 8. 無保証
50
+
51
+ 本ソフトウェアは「現状のまま」提供されます。商品性、特定目的への適合性および非侵害についての保証を含め、明示または黙示を問わず、いかなる保証もありません。
52
+
53
+ ### 9. 責任の制限
54
+
55
+ 適用法令が許す最大限の範囲で、著作者および著作権者は、契約、不法行為その他の原因を問わず、本ソフトウェアまたはその使用その他の取引から生じ、またはこれらに関連する請求、損害その他の責任を負いません。この制限は、適用される強行法規により排除または制限できない責任には適用されません。
56
+
57
+ ### 10. 準拠法および管轄
58
+
59
+ 本ライセンスは日本法に準拠し、日本法に従って解釈されます。本ライセンスに関する紛争については、東京地方裁判所を第一審の専属的合意管轄裁判所とします。
60
+
61
+ ---
62
+
63
+ ## English Reference Translation
64
+
65
+ The Japanese version above is authoritative. This English version is provided for reference only.
66
+
67
+ ### 1. Definitions and Scope
68
+
69
+ “Software” means the Artifact Share software and associated documentation to which this license is attached, including `@artifactshare/cli` under `packages/cli/`.
70
+
71
+ “Licensor” means TechTalk, Inc. “You” means an individual or legal entity that obtains a copy of the Software and exercises rights under this license.
72
+
73
+ ### 2. Permission Grant
74
+
75
+ Subject to the terms of this license, You are granted, free of charge, the rights to use, copy, modify, merge, publish, distribute, sublicense, and sell the Software, and to permit persons to whom the Software is furnished to do the same.
76
+
77
+ ### 3. Preservation of Notices
78
+
79
+ The copyright notice above and the complete text of this license must be included in all copies or substantial portions of the Software.
80
+
81
+ ### 4. Restriction on Offering a Competing Service
82
+
83
+ You and downstream recipients must not offer the Software, including modified or derivative versions, to third parties as a hosted, managed, Software-as-a-Service, or cloud service that directly competes with the Licensor and whose primary value is the functionality of the Software itself. The permission to sublicense or sell under Section 2 does not grant a right to circumvent this restriction.
84
+
85
+ The following uses are not prohibited solely by this Section:
86
+
87
+ - self-hosting operated by an organization for its own business use;
88
+ - deployment and maintenance by a vendor in an environment dedicated to one customer, provided that the vendor does not itself offer a competing service to multiple customers; and
89
+ - incorporation into another product or service whose primary value is not the functionality of Artifact Share itself.
90
+
91
+ For a commercial license covering a use restricted by this Section, contact `support@artifactshare.com`.
92
+
93
+ ### 5. Names and Trademarks
94
+
95
+ This license grants no rights in the Artifact Share name, logos, service marks, or other trademarks. You may use them only as necessary to describe origin accurately or to redistribute unmodified brand assets included with the Software together with the Software. You must not use them in a way that is likely to imply an official version, approval, affiliation, or sponsorship by the Licensor.
96
+
97
+ ### 6. Proposals and Contributions
98
+
99
+ Contributors retain copyright in proposals and other submissions. A contributor grants the Licensor and the maintainers of the Software a worldwide, non-exclusive, royalty-free, sublicensable license to evaluate, accept, incorporate into the Software, modify, reproduce, publish, and distribute the submission.
100
+
101
+ This Section is not an invitation for code contributions at this time. If code contributions are accepted in the future, their inbound license terms and any contributor agreement will be stated separately.
102
+
103
+ ### 7. Termination
104
+
105
+ Your rights under this license terminate if You violate its terms. If You cure all violations within 30 days after becoming aware of them, Your rights are automatically reinstated for the first violation. Reinstatement after an uncured or repeated violation requires the Licensor's written consent.
106
+
107
+ ### 8. Disclaimer of Warranty
108
+
109
+ THE SOFTWARE IS PROVIDED “AS IS,” WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT.
110
+
111
+ ### 9. Limitation of Liability
112
+
113
+ TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE AUTHORS AND COPYRIGHT HOLDERS SHALL NOT BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT, OR OTHERWISE, ARISING FROM OR RELATED TO THE SOFTWARE OR ITS USE OR OTHER DEALINGS. THIS LIMITATION DOES NOT APPLY TO LIABILITY THAT CANNOT BE EXCLUDED OR LIMITED UNDER MANDATORY APPLICABLE LAW.
114
+
115
+ ### 10. Governing Law and Jurisdiction
116
+
117
+ This license is governed by and construed in accordance with the laws of Japan. The Tokyo District Court has exclusive jurisdiction as the court of first instance over disputes relating to this license.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Artifact Share CLI
2
2
 
3
+ Copyright © TechTalk, Inc.
4
+
3
5
  The official CLI to open, share, and update files, folders, and static sites on [Artifact Share](https://artifactshare.com) from terminals, AI agents, and automation. Share HTML, Markdown, and exported sites to stable URLs, update existing files, and emit `--json` for scripts and agents.
4
6
 
5
7
  Artifact Share hosts AI-built reports, documents, and static sites so you can share them with teammates and clients. This CLI shares a single file or a whole folder (HTML, Markdown, exported SPAs, images included), updates versions, opens shared URLs for agents, reads content and comments back, and works the same for humans, terminal agents (Claude Code, Codex, Cursor Agent), and automation.
@@ -43,7 +45,7 @@ runs add versions to the same file.
43
45
 
44
46
  - **Interactive**: run `npx --yes @artifactshare/cli login`, or run `share`, `update`, or `download` directly — those commands start sign-in for you when unauthenticated (the CLI prints a link and code to open in your browser). Profiles created by `login` renew expired CLI sessions automatically during normal use.
45
47
  - **CI / non-interactive**: issue a token at `https://artifactshare.com/settings/tokens`, then set `ARTIFACTSHARE_TOKEN` (or pass `--token`). Without a token, non-interactive runs fail with `error.code: "auth_required"` instead of hanging.
46
- - Multiple accounts: keep one local profile per account (`profiles list` / `profiles use <name>`). In non-interactive agents, pipe an issued token into `profiles import-token --profile <name> --json` to create a saved API-token profile without browser login; API-token profiles are not renewed by the CLI. Use `logout --profile <name>` to remove a saved credential while keeping profile metadata, or `profiles delete <name>` to remove the profile entry too.
48
+ - Multiple accounts: keep one local profile per account (`profiles list` / `profiles use <name>`). In non-interactive agents, pipe an issued token into `profiles import-token --profile <name> --json` to create a saved API-token profile without browser login; API-token profiles are not renewed by the CLI. Use `logout --profile <name>` to revoke a device-login credential before removing it locally while keeping profile metadata, or `profiles delete <name>` to remove the profile entry too. API-token profiles are only removed locally.
47
49
 
48
50
  ## Commands
49
51
 
@@ -61,7 +63,7 @@ runs add versions to the same file.
61
63
  | `comments list / post / edit / resolve / reopen / delete <target>` | Read, write, edit, resolve, reopen, and permanently delete comments |
62
64
  | `projects list / create / edit` | List, create, and edit project destinations and audience |
63
65
  | `move <target>` | Move an existing file into a project or back home; `edit` is preferred for new automation |
64
- | `login` / `logout` / `whoami` | Sign in, remove a saved local credential, and check who you are |
66
+ | `login` / `logout` / `whoami` | Sign in, revoke a device-login credential before removing it locally, and check who you are |
65
67
  | `doctor` | Diagnose auth, destination, network, and upload readiness — tells you the next command to run |
66
68
  | `changelog` | Show the installed version, this release's notes, and the public updates page |
67
69
  | `profiles list / use / import-token / delete` | Switch between local account profiles, import an issued token from stdin, and delete profile entries |
@@ -124,3 +126,7 @@ Quote paths and free-form text before passing them through a shell. Artifact Sha
124
126
  - Setup guide for AI tools and terminals: https://artifactshare.com/connect
125
127
  - Public updates (Web, CLI, Agent, MCP): https://artifactshare.com/updates
126
128
  - Artifact Share: https://artifactshare.com
129
+
130
+ ## License
131
+
132
+ The npm package through version 0.9.0 is licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). From version 0.10.0 onward, `@artifactshare/cli` is covered by the [source-available license](LICENSE). Version 0.10.0 was intentionally not published; version 0.10.1 is the first npm release under the new license.
package/dist/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { };
1
+ export {}
package/dist/index.js CHANGED
@@ -3,11 +3,11 @@ import { cli, define, lazy } from "gunshi";
3
3
  import { spawn } from "node:child_process";
4
4
  import { appendFile, chmod, lstat, mkdir, mkdtemp, readFile, readdir, realpath, rename, rm, rmdir, stat, writeFile } from "node:fs/promises";
5
5
  import { basename, dirname, join, relative, resolve, sep } from "node:path";
6
+ import { createHash, randomUUID } from "node:crypto";
6
7
  import { setTimeout as setTimeout$1 } from "node:timers/promises";
7
8
  import { homedir } from "node:os";
8
9
  import { createReadStream } from "node:fs";
9
10
  import { Blob } from "node:buffer";
10
- import { createHash } from "node:crypto";
11
11
  //#region src/constants.ts
12
12
  const DEFAULT_BASE_URL = "https://artifactshare.com";
13
13
  const DEVICE_CLIENT_ID = "artifactshare-cli";
@@ -1790,7 +1790,8 @@ function parseStoredProfileCredential(raw) {
1790
1790
  kind: "session",
1791
1791
  session_token: parsed.session_token,
1792
1792
  refresh_token: parsed.refresh_token,
1793
- ...parsed.expires_at !== void 0 ? { expires_at: parsed.expires_at } : {}
1793
+ ...parsed.expires_at !== void 0 ? { expires_at: parsed.expires_at } : {},
1794
+ ...typeof parsed.pending_rotation_id === "string" && parsed.pending_rotation_id ? { pending_rotation_id: parsed.pending_rotation_id } : {}
1794
1795
  };
1795
1796
  return {
1796
1797
  ok: true,
@@ -2599,12 +2600,27 @@ async function runAuthenticatedApi(credential, options, request) {
2599
2600
  return await request(refreshed.credential);
2600
2601
  }
2601
2602
  async function refreshStoredProfileSession(profile, refreshToken, options) {
2603
+ const stored = await readProfileToken(profile, options);
2604
+ if (!stored.ok || stored.credential.kind !== "session") return { ok: false };
2605
+ const rotationRequestId = stored.credential.pending_rotation_id ?? randomUUID();
2606
+ if (!stored.credential.pending_rotation_id) {
2607
+ if (!(await saveProfileSessionCredential(profile, {
2608
+ ...stored.credential,
2609
+ pending_rotation_id: rotationRequestId
2610
+ }, options)).ok) return {
2611
+ ok: false,
2612
+ error: tokenStoreUnavailableError(profile)
2613
+ };
2614
+ }
2602
2615
  const request = await requestConfig(options);
2603
2616
  if (request.error) return {
2604
2617
  ok: false,
2605
2618
  error: request.error
2606
2619
  };
2607
- const result = await apiPostPublic("/api/cli/auth/refresh", { refresh_token: refreshToken }, options, request.init);
2620
+ const result = await apiPostPublic("/api/cli/auth/refresh", {
2621
+ refresh_token: refreshToken,
2622
+ rotation_request_id: rotationRequestId
2623
+ }, options, request.init);
2608
2624
  if (result.error) return {
2609
2625
  ok: false,
2610
2626
  error: result.error
@@ -2617,14 +2633,14 @@ async function refreshStoredProfileSession(profile, refreshToken, options) {
2617
2633
  error: mapApiError(response.status, body, { baseUrl: baseUrlOf(options) })
2618
2634
  };
2619
2635
  }
2620
- if (typeof body?.access_token !== "string" || body.access_token.length === 0 || body.token_type?.toLowerCase() !== "bearer" || typeof body.expires_at !== "string") return {
2636
+ if (typeof body?.access_token !== "string" || body.access_token.length === 0 || body.token_type?.toLowerCase() !== "bearer" || typeof body.expires_at !== "string" || typeof body.refresh_token !== "string" || !body.refresh_token || typeof body.refresh_token_expires_at !== "string") return {
2621
2637
  ok: false,
2622
2638
  error: validationError("Refresh response was invalid.", "Run login again. If this repeats, report the response shape.", "service_error")
2623
2639
  };
2624
2640
  if (!(await saveProfileSessionCredential(profile, {
2625
2641
  kind: "session",
2626
2642
  session_token: body.access_token,
2627
- refresh_token: refreshToken,
2643
+ refresh_token: body.refresh_token,
2628
2644
  expires_at: body.expires_at
2629
2645
  }, options)).ok) return {
2630
2646
  ok: false,
@@ -4435,11 +4451,17 @@ function configData(config, resolved) {
4435
4451
  //#endregion
4436
4452
  //#region src/command-runners/profile-credentials.ts
4437
4453
  async function deleteCredentialForProfileEntry(profile, rawEntry, options) {
4454
+ return await deleteProfileCredential(profile, optionsForProfileEntry(rawEntry, options));
4455
+ }
4456
+ async function readCredentialForProfileEntry(profile, rawEntry, options) {
4457
+ return await readProfileToken(profile, optionsForProfileEntry(rawEntry, options));
4458
+ }
4459
+ function optionsForProfileEntry(rawEntry, options) {
4438
4460
  const entry = isRecord(rawEntry) ? rawEntry : {};
4439
- return await deleteProfileCredential(profile, {
4461
+ return {
4440
4462
  ...options,
4441
4463
  baseUrl: nonEmpty(entry.base_url) ?? "https://artifactshare.com"
4442
- });
4464
+ };
4443
4465
  }
4444
4466
  //#endregion
4445
4467
  //#region src/command-runners/logout.ts
@@ -4463,6 +4485,15 @@ async function runLogout(parsed, mode) {
4463
4485
  profile = defaultProfile;
4464
4486
  }
4465
4487
  const rawEntry = config.profiles?.[profile];
4488
+ const profileOptions = optionsForProfileEntry(rawEntry, parsed.options);
4489
+ const stored = await readCredentialForProfileEntry(profile, rawEntry, parsed.options);
4490
+ if (stored.ok && stored.credential.kind === "session") {
4491
+ const request = await requestConfig(profileOptions);
4492
+ if (request.error) return writeFailure(command, request.error, mode, 1);
4493
+ const revoked = await apiPostPublic("/api/cli/auth/revoke", { refresh_token: stored.credential.refresh_token }, profileOptions, request.init);
4494
+ if (revoked.error) return writeFailure(command, revoked.error, mode, 1);
4495
+ if (!revoked.response.ok && revoked.response.status !== 401) return writeFailure(command, mapApiError(revoked.response.status, revoked.body, { baseUrl: baseUrlOf(profileOptions) }), mode, 1);
4496
+ }
4466
4497
  const deleted = await deleteCredentialForProfileEntry(profile, rawEntry, parsed.options);
4467
4498
  if (!deleted.ok) return writeFailure(command, tokenStoreUnavailableError(profile), mode, 1);
4468
4499
  return writeSuccess(command, {
@@ -5670,13 +5701,13 @@ Common failures:
5670
5701
  });
5671
5702
  const logoutDefinition = define({
5672
5703
  name: "logout",
5673
- description: "Remove the saved credential for a CLI profile.",
5704
+ description: "Revoke and remove the saved credential for a CLI profile.",
5674
5705
  toKebab: true,
5675
5706
  args: commonArgs,
5676
5707
  examples: `npx --yes @artifactshare/cli logout --profile client-a --json
5677
5708
  npx --yes @artifactshare/cli logout --json
5678
5709
 
5679
- logout removes the local credential only. Profile metadata stays in config.json for re-login hints.
5710
+ logout revokes a device-login refresh credential before removing it locally. API-token profiles are removed locally only. Profile metadata stays in config.json for re-login hints.
5680
5711
  When no --profile is passed, the global default profile is used.
5681
5712
 
5682
5713
  Common failures:
package/package.json CHANGED
@@ -1,9 +1,14 @@
1
1
  {
2
2
  "name": "@artifactshare/cli",
3
- "version": "0.9.0",
3
+ "version": "0.10.2",
4
4
  "description": "Upload and share HTML, Markdown, folders, and static sites from terminals, AI agents, automation, and CI.",
5
5
  "homepage": "https://artifactshare.com/connect",
6
- "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/artifactshare/artifactshare.git",
9
+ "directory": "packages/cli"
10
+ },
11
+ "license": "SEE LICENSE IN LICENSE",
7
12
  "keywords": [
8
13
  "artifact-share",
9
14
  "cli",
@@ -33,7 +38,7 @@
33
38
  },
34
39
  "dependencies": {
35
40
  "gunshi": "^0.37.0",
36
- "undici": "^8.7.0"
41
+ "undici": "^8.10.0"
37
42
  },
38
43
  "devDependencies": {
39
44
  "@types/node": "22.20.1",
@@ -61,7 +61,7 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
61
61
  | Create a project | `projects create 'Name' --json` |
62
62
  | Find an ID from a title | `resolve <value> --json` |
63
63
  | Open a share URL | `open <url> --json` |
64
- | Log out locally | `logout --profile <name> --json` |
64
+ | Log out | `logout --profile <name> --json` |
65
65
 
66
66
  ## Authentication
67
67
 
@@ -72,9 +72,10 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
72
72
  browser for approval. Use it when a user is present; the pending event on
73
73
  stderr includes `browser_open`. Do not pass API tokens to `login`.
74
74
  Profiles created by `login` renew expired CLI sessions automatically.
75
- - `logout --profile <name> --json` removes the saved local credential for a
76
- profile and leaves profile metadata in `config.json`. Without `--profile`,
77
- it uses the default profile. This does not revoke API tokens on the server.
75
+ - `logout --profile <name> --json` revokes a device-login refresh credential
76
+ before removing it locally and leaves profile metadata in `config.json`.
77
+ If remote revoke fails, the local credential is kept and logout fails.
78
+ API-token profiles are removed locally only and are not revoked on the server.
78
79
  - To keep using an issued token as a named profile without TTY or browser
79
80
  login, pipe it on standard input:
80
81
  `printf '%s' "$TOKEN" | npx --yes @artifactshare/cli profiles import-token --profile <name> --json`.
@@ -52,7 +52,7 @@ contain `$`, spaces, `*`, or `?`; use single quotes such as
52
52
  - In agents, CI, or scripts, ask the user to issue an API token at `https://artifactshare.com/settings/tokens`, then run normal commands with `ARTIFACTSHARE_TOKEN` or `--token`; do not pass API tokens to `login`.
53
53
  - To save that token as a named profile without TTY or browser login, pipe it on standard input: `printf '%s' "$TOKEN" | npx --yes @artifactshare/cli profiles import-token --profile <name> --json`. Imported API-token profiles are not renewed by the CLI. Add `--allow-plaintext-token-store` only on a trusted machine without a native token store.
54
54
  - Use `login --profile <name> --json` when a user is present for browser approval. The pending event on stderr includes `browser_open`. Profiles created by `login` renew expired CLI sessions automatically.
55
- - Remove a saved local credential with `logout --profile <name> --json`; this keeps profile metadata and does not revoke API tokens on the server.
55
+ - Use `logout --profile <name> --json` to revoke a device-login credential before removing it locally; this keeps profile metadata. API-token profiles are removed locally only and their server token is not revoked.
56
56
  - Switch profiles with `profiles use <name> --json`; list with `profiles list --json`; remove a profile entry and its credential with `profiles delete <name> --json`.
57
57
  - When the user gives an Artifact Share URL, start with `open <artifact-id-or-url> --json`. It ensures this rule is installed or updated, then reads single-file artifacts or returns a `download` next command for static sites and multi-file artifacts.
58
58
  - Share with `share <path> --json`. In JSON output, give the user `data.artifact.url`; the artifact ID is `data.artifact.id`. Do not rerun `share` just to inspect the JSON shape: without `--key`, each successful run creates a new artifact. Posting to a project delivers to the audience defined by that project. Pick it with `--project-id <id>` or `--project <name>` (by exact name), or use the saved default. With no destination, share posts to home. Choose `home_audience` by purpose: use `config set home_audience private --scope user --json` for a personal safe default in this CLI environment, use `--scope repository` only for a policy agreed by all participants, and use `--visibility private|workspace|link` for one home post. For link sharing, pass exactly one of `--link-expires-at <RFC3339 UTC>` or `--no-link-expiry`; omit both to use the workspace default. Confirm the resolved audience with `config get home_audience --scope effective --json`; `--grant-email` does not change the resolved default.