needle-cloud 2.9.0 → 2.10.0-rc.1791986367.11d2809

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
@@ -4,6 +4,30 @@ All notable changes to this package will be documented in this file.
4
4
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [2.10.0] - 2026-10-14
8
+ ### Added
9
+ - `label list` and `label set` to inspect labels, promote a completed version, create custom labels, or roll back, with JSON output and token/team support.
10
+ - `upload --wait` to wait for a selected optimized asset and optionally download it with `--outdir`.
11
+ - `--format json`, `--format source-url`, and `--format edit-url` on upload and optimize commands, with pinned source identities and separately labeled optimized URLs.
12
+ - `mcp` stdio support that starts or reuses the shared local server and keeps browser/Inspector tools available through the bridge.
13
+ - `status` to inspect the local server, port and process ID.
14
+ - Runtime snapshot read helpers in the browser SDK.
15
+
16
+ ### Changed
17
+ - Upload and optimize use one workflow; optimize remains compatible shorthand for upload with waiting enabled.
18
+ - Upload progress and diagnostics go to stderr so structured and scalar output can be used reliably in scripts.
19
+ - Grouped directory uploads return a source-file URL list in JSON; source-url output requires a single file.
20
+ - Local file tools enforce project boundaries, refuse sensitive files and hard-link aliases, and redact recognizable secrets before reads, searches and previews.
21
+ - Local MCP requests validate loopback hosts and browser origins; the stdio bridge attaches local credentials automatically.
22
+
23
+ ### Fixed
24
+ - Failed SDK label updates no longer print a success message; strict callers receive the HTTP failure details.
25
+ - Healthy idle MCP notification streams no longer repeatedly disconnect and reconnect.
26
+ - MCP agent names are preserved through the stdio bridge.
27
+ - Upload and optimize accept environment access tokens without requiring an interactive login.
28
+ - `--progressive false` is respected when selecting an optimization variant.
29
+ - Development SDK sign-in callbacks work with local authentication tunnels.
30
+
7
31
  ## [2.9.0] - 2026-10-01
8
32
  ### Added
9
33
  - Approved local project commands for creating Needle projects, installing packages, building, and deploying from Cloud chat.
package/README.md CHANGED
@@ -35,6 +35,51 @@ npx needle-cloud help <command> # Help for a specific command
35
35
  - `start` — Start the local server for licensing, editor integrations, and MCP tools
36
36
  - `settings` — View CLI settings, including [local tool access for Needle Cloud AI](#local-tools-in-needle-cloud-ai)
37
37
 
38
+ ## Upload assets
39
+
40
+ ```bash
41
+ # Upload the source; processing continues in the background
42
+ npx needle-cloud upload ./model.glb --team "My Team"
43
+
44
+ # Print only the URL for this exact uploaded source file
45
+ npx needle-cloud upload ./model.glb --format source-url
46
+
47
+ # Return source identity and links as JSON
48
+ npx needle-cloud upload ./models --format json
49
+
50
+ # Wait for optimization and download the result
51
+ npx needle-cloud upload ./model.glb --wait --outdir ./optimized
52
+
53
+ # Existing scripts continue to work
54
+ npx needle-cloud optimize ./model.glb --outdir ./optimized
55
+ ```
56
+
57
+ Use `--no-optimize` to upload without requesting processing. `--wait` selects the
58
+ optimized variant with `--progressive true|false` and `--usecase product|world`.
59
+ The latter options and `--outdir` require waiting. `optimize` always waits.
60
+
61
+ Both commands support `--format cli` (default), `json`, `source-url`, and
62
+ `edit-url`. Progress and diagnostics, including `--verbose` output, go to stderr;
63
+ stdout contains only the selected result. Errors produce a nonzero exit code.
64
+ Authentication supports saved login, `--token`, or `NEEDLE_CLOUD_TOKEN`; `--team`
65
+ selects the team for saved-login uploads. Access tokens retain their team scope.
66
+
67
+ JSON contains `assetId`, `versionId`, `editUrl`, `sourceUrl`, `optimizedUrl`,
68
+ `processingStatus`, and `files`. Source URLs are pinned to the uploaded version;
69
+ optimization never changes `versionId` or the source links. After waiting,
70
+ `optimizedUrl` is pinned to the selected optimization and `optimization` describes
71
+ its version, progressive setting and use case.
72
+
73
+ Folders are collected recursively into one grouped upload, preserving current
74
+ behavior. The JSON `files` array contains a path and source URL for every uploaded
75
+ file. `sourceUrl` is null for a multi-file upload; `--format source-url` refuses
76
+ multiple files before uploading. `edit-url` returns the group's management URL.
77
+
78
+ Without waiting, `processingStatus` is `unknown`: background processing is not
79
+ queried. `--no-optimize` reports `not_requested` for this invocation; it does not
80
+ cancel processing from earlier uploads. Waiting reports `completed` for the
81
+ requested variant, which can differ from other background processing jobs.
82
+
38
83
  Manage stored content by using the identifier shown by `list`:
39
84
 
40
85
  ```bash
@@ -50,6 +95,44 @@ Deleting content immediately frees total storage capacity, but it does not refun
50
95
  the current month's upload usage. Deleted content can be restored from Trash for
51
96
  31 days when the account has enough total storage available for it.
52
97
 
98
+ ## Content labels
99
+
100
+ Labels keep a stable URL while you change the version it serves:
101
+
102
+ ```bash
103
+ npx needle-cloud label list <content-id> --team "My Team"
104
+
105
+ # Promote the source version currently served by latest
106
+ npx needle-cloud label set <content-id> main --from latest
107
+
108
+ # Move a label to an explicit completed version, including an older version
109
+ npx needle-cloud label set <content-id> main --version <version-id>
110
+
111
+ # Create or move a custom label and return the result as JSON
112
+ npx needle-cloud label set <content-id> staging --from latest --format json
113
+ ```
114
+
115
+ `label set` requires exactly one of `--version` or `--from`. The selected version
116
+ must belong to this content item and have completed processing. The server also
117
+ moves the label for related completed outputs. `latest` updates automatically;
118
+ it can be used with `--from` but cannot be assigned manually. New label names use
119
+ lowercase letters, numbers, hyphens or underscores.
120
+
121
+ Both commands support `--token`, `NEEDLE_CLOUD_TOKEN`, saved login, `--team`, and
122
+ `--format cli|json`. Listing requires read access; setting also requires write
123
+ access. Use the content ID and version ID returned by upload, or the IDs shown by
124
+ `list` and `label list`.
125
+
126
+ JSON lists each label's `sourceVersionIds` and `targets`. Each target includes
127
+ `versionId`, `sourceVersionId`, `displayName` and `url`, so source and derived
128
+ outputs remain distinguishable. A null or hidden URL is retained as returned by
129
+ Cloud. Setting returns `contentId`, `label`, the selected `versionId`, observed
130
+ `previousVersionIds`, and the confirmed `targets`. The previous state is a
131
+ snapshot; concurrent updates are not locked. If the update succeeds but cannot
132
+ be confirmed afterward, the command reports that explicitly and exits nonzero.
133
+
134
+ Diagnostics go to stderr; stdout contains only the requested result.
135
+
53
136
  ## Local tools in Needle Cloud AI
54
137
 
55
138
  [Needle Cloud AI](https://cloud.needle.tools/team#ai) can use local tools provided by this CLI to read project files, search your code, and inspect logs. You can enable or disable local tools in an individual chat. See the [Needle Cloud AI documentation](https://engine.needle.tools/docs/cloud/#needle-cloud-ai) for how this works with your Unity or Blender project.
@@ -93,6 +176,30 @@ npx needle-cloud settings local-project-commands false
93
176
 
94
177
  Both settings are enabled by default, but Needle Cloud chat still asks for approval before it edits a file or starts a project command. A Cloud approval cannot override a disabled local setting. Pass `true` to either command to turn that capability back on. Project commands cover creating a Needle project, installing packages, running its build or dev script, and deploying an existing build. These commands can run project or package scripts; a deployment publishes files to the selected team. `needle-cloud settings` shows the current values.
95
178
 
179
+ To find the local server's version and process ID (for example, in Task Manager):
180
+
181
+ ```bash
182
+ npx needle-cloud status
183
+ ```
184
+
185
+ This only checks the running server. It does not start or restart it. For older
186
+ servers, a PID read from the local server record is labeled `recorded`.
187
+
188
+ For AI clients that support stdio, use:
189
+
190
+ ```toml
191
+ [mcp_servers.needle]
192
+ command = "npx"
193
+ args = ["-y", "needle-cloud", "mcp"]
194
+ ```
195
+
196
+ On Windows, use `npx.cmd` if your client cannot resolve `npx`.
197
+ The command reuses or starts the local server, exposes its tools over stdio,
198
+ and reconnects if that server restarts. Inspector and Unity tools appear as
199
+ those apps connect. Closing the AI client stops its stdio process; the shared
200
+ local server stays available to other apps. Cloud access follows your
201
+ `remote-ai-tools` setting and requires a signed-in account.
202
+
96
203
  See the [Needle MCP documentation](https://engine.needle.tools/docs/ai/needle-mcp-server) for available tools and how to connect other AI assistants.
97
204
 
98
205
  ## CI/CD
package/bin/cli.js CHANGED
@@ -1,3 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { program } from '../dist/cli.esm.js';
3
- program.run();
2
+ import { Console } from 'node:console';
3
+ // Configure diagnostics before loading the bundle, including SDK/startup logs.
4
+ // Result output uses process.stdout.write explicitly in command actions.
5
+ if (process.argv[2] === 'upload' || process.argv[2] === 'optimize' || process.argv[2] === 'label') {
6
+ globalThis.console = new Console({stdout:process.stderr,stderr:process.stderr});
7
+ }
8
+ const { program } = await import('../dist/cli.esm.js');
9
+ program.run();