Skip to content

Commit 03727a2

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/generic-oauth-client
# Conflicts: # apps/workspace/server/src/middleware/errors.ts
2 parents c14d754 + bfddea0 commit 03727a2

69 files changed

Lines changed: 5733 additions & 2695 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/push.yml

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ on:
44
workflow_dispatch:
55
inputs:
66
release_tag:
7-
description: Existing stable Workspace release tag in vX.Y.Z form
7+
description: Optional existing stable Workspace release tag in vX.Y.Z form
88
type: string
9-
required: true
9+
required: false
1010

1111
environment:
1212
description: 'Environment to run deploy'
@@ -38,6 +38,8 @@ jobs:
3838
name: BuildDockerImage
3939
runs-on: ${{ inputs.runner-name == 'github-runner' && 'ubuntu-latest' || inputs.runner-name }}
4040
environment: ${{ inputs.environment }}
41+
outputs:
42+
image_tag: ${{ steps.release.outputs.image_tag }}
4143
env:
4244
GH_ACCESS_TOKEN: ${{ secrets.GH_TOKEN }}
4345
CR: univer-acr-registry.cn-shenzhen.cr.aliyuncs.com
@@ -49,29 +51,35 @@ jobs:
4951
with:
5052
fetch-depth: 0
5153
persist-credentials: false
52-
ref: refs/tags/${{ inputs.release_tag }}
54+
ref: ${{ inputs.release_tag == '' && github.sha || format('refs/tags/{0}', inputs.release_tag) }}
5355

54-
- name: Validate release tag
56+
- name: Resolve deployment source
5557
id: release
5658
shell: bash
5759
env:
5860
BASE_BRANCH: ${{ github.event.repository.default_branch }}
61+
DISPATCH_SHA: ${{ github.sha }}
5962
RELEASE_TAG: ${{ inputs.release_tag }}
6063
run: |
6164
set -euo pipefail
62-
if [[ ! "$RELEASE_TAG" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
63-
echo "release_tag must use stable vX.Y.Z form" >&2
64-
exit 1
65-
fi
66-
if [[ "$(git rev-parse "refs/tags/$RELEASE_TAG^{commit}")" != "$(git rev-parse HEAD)" ]]; then
67-
echo "Checkout does not match release tag $RELEASE_TAG" >&2
68-
exit 1
69-
fi
70-
if ! git merge-base --is-ancestor HEAD "refs/remotes/origin/$BASE_BRANCH"; then
71-
echo "Release tag commit must be contained in origin/$BASE_BRANCH" >&2
72-
exit 1
65+
if [[ -n "$RELEASE_TAG" ]]; then
66+
if [[ ! "$RELEASE_TAG" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
67+
echo "release_tag must use stable vX.Y.Z form" >&2
68+
exit 1
69+
fi
70+
if [[ "$(git rev-parse "refs/tags/$RELEASE_TAG^{commit}")" != "$(git rev-parse HEAD)" ]]; then
71+
echo "Checkout does not match release tag $RELEASE_TAG" >&2
72+
exit 1
73+
fi
74+
if ! git merge-base --is-ancestor HEAD "refs/remotes/origin/$BASE_BRANCH"; then
75+
echo "Release tag commit must be contained in origin/$BASE_BRANCH" >&2
76+
exit 1
77+
fi
78+
IMAGE_TAG="$RELEASE_TAG"
79+
else
80+
IMAGE_TAG="sha-$DISPATCH_SHA"
7381
fi
74-
echo "image_tag=$RELEASE_TAG" >> "$GITHUB_OUTPUT"
82+
echo "image_tag=$IMAGE_TAG" >> "$GITHUB_OUTPUT"
7583
7684
- uses: ./.github/actions/setup
7785
id: setup
@@ -82,6 +90,7 @@ jobs:
8290
- name: Build and Push Image
8391
env:
8492
IMAGE_TAG: ${{ steps.release.outputs.image_tag }}
93+
UNIVER_WORKSPACE_BROWSER_LICENSE: ${{ secrets.UNIVER_WORKSPACE_BROWSER_LICENSE }}
8594
run: |
8695
make push_image "IMAGE_TAG=$IMAGE_TAG" "CR=$CR"
8796
@@ -92,12 +101,8 @@ jobs:
92101
environment: ${{ inputs.environment }}
93102
env:
94103
CR: univer-acr-registry.cn-shenzhen.cr.aliyuncs.com
104+
IMAGE_TAG: ${{ needs.build-docker-image.outputs.image_tag }}
95105
steps:
96-
- name: Set IMAGE_TAG environment variable
97-
env:
98-
RELEASE_TAG: ${{ inputs.release_tag }}
99-
run: echo "IMAGE_TAG=$RELEASE_TAG" >> "$GITHUB_ENV"
100-
101106
- name: Set FEATURE environment variable
102107
if: ${{ startsWith(inputs.environment, 'feature') }}
103108
run: echo "FEATURE=$(echo ${GITHUB_REF#refs/heads/feat/})" >> "$GITHUB_ENV"

AGENTS.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ pnpm update:sdk --sdk_version <exact-sdk-version>
8989
发布前必须检查整个 workspace 的单一 SDK baseline;`dev` 明确跳过该检查。
9090
- CLI package artifact 必须只包含运行所需代码、资源和版本匹配的 Skills,不得依赖当前 checkout。
9191
- `packages/reference-provider` 不增加独立发布、版本或外部 consumer 合同。
92-
- 稳定 `vX.Y.Z` tag 是 CLI release 与 Workspace deployment 共享的不可变源码坐标;tag push 只发布
93-
CLI,部署 workflow 只手动部署所选 tag。Docker image 和 CLI artifact 的交付时机与执行流程仍然独立。
92+
- 稳定 `vX.Y.Z` tag 在被选择时是 CLI release 与 Workspace deployment 共享的不可变源码坐标;tag push
93+
只发布 CLI。部署 workflow 也可以不选 tag,改为手动部署 workflow dispatch 的精确 commit,并使用
94+
`sha-<commit>` image tag。Docker image 和 CLI artifact 的交付时机与执行流程仍然独立。
9495
- 当前 release workflow 只写 insider-npm;公开 npm Promotion 属于独立后续工作,不得加入该 workflow。
9596

9697
## 文档维护

DREAMNUM.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
collaboration entry points, and background recovery processes. Contract: [Workspace README](apps/workspace/README.md)
2424
and [OpenAPI source](apps/workspace/contracts/http/openapi.yaml).
2525
- **Univer Workspace CLI** — the internally packaged `univer-workspace-cli` application for agent-driven remote
26-
Workspace authoring, inspection, rendering, exchange, Worktree, and review workflows. Contract:
26+
Workspace authoring, inspection, rendering, exchange, Worktree, and review workflows, with browser-approved
27+
passwordless CLI session handoff for password and external-identity users. Contract:
2728
[CLI README](apps/cli/README.md) and [release workflow](.github/workflows/release-cli.yml).
2829

2930
## Depends on
@@ -63,12 +64,15 @@
6364
retain their identities, metadata, and recovery state.
6465
- Login sessions, password hashes, stable GitHub and Discord user identifiers, ACLs, sharing state, and user-authored
6566
content are protected application data. OAuth access tokens are used only during sign-in and are not persisted.
67+
- Short-lived pending CLI browser authorizations are bounded process-local state; approval issues a separate normal
68+
persisted login session and does not pass a browser cookie, password, or OAuth access token through the agent.
6669
- OAuth secrets, trusted Bot credentials, registry credentials, production licenses, and deployment credentials are
6770
environment or build configuration and must not be committed to the repository.
68-
- Stable `vX.Y.Z` tags are immutable source coordinates shared by the stable CLI release and manually selected
69-
Workspace deployments. Tag push publishes only the CLI; deployment remains a separate manual workflow.
70-
- Production images use the selected release tag and are handed off to the private deployment repository; database
71-
migration and rollout ordering remain part of the Workspace application contract.
71+
- Stable `vX.Y.Z` tags are immutable source coordinates shared by the stable CLI release and Workspace deployments
72+
that select a release tag. Tag push publishes only the CLI; deployment remains a separate manual workflow.
73+
- Workspace images use either the selected release tag or `sha-<commit>` for an untagged workflow dispatch and are
74+
handed off to the private deployment repository; database migration and rollout ordering remain part of the
75+
Workspace application contract.
7276

7377
## Update contract
7478

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ IMAGE_TAG ?= latest
66
IMAGE_DIR = ./apps/workspace
77

88
push_image:
9-
@docker build -f $(IMAGE_DIR)/Dockerfile -t $(CR)/$(NS)/$(REPOSITORY):$(IMAGE_TAG) . --push
9+
@docker build --build-arg VITE_UNIVER_LICENSE="$${UNIVER_WORKSPACE_BROWSER_LICENSE}" -f $(IMAGE_DIR)/Dockerfile -t $(CR)/$(NS)/$(REPOSITORY):$(IMAGE_TAG) . --push

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,11 @@ that graph check. All three paths build, verify, install, and smoke-test the act
8484
tarball before publication. This workflow ends at insider-npm and does not perform a
8585
Public Registry Promotion.
8686

87-
Workspace deployment is a separate manual workflow. It requires an existing stable
88-
`vX.Y.Z` release tag, builds that exact commit, pushes an image with the same tag, and
89-
hands the image to the selected deployment environment. Pushing the tag does not deploy
90-
the server.
87+
Workspace deployment is a separate manual workflow. It can build a selected existing
88+
stable `vX.Y.Z` release tag and use that tag for the image, or, when no release tag is
89+
provided, build the workflow dispatch commit and tag the image as `sha-<commit>`. It
90+
hands the resulting image to the selected deployment environment. Pushing a tag does
91+
not deploy the server.
9192

9293
## Runtime development license
9394

apps/cli/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,38 @@ Workspace deployment, run `univer-workspace-cli config set workspace.origin <ori
7777
agent access to the executable and the intended Workspace; the bundled guidance supplies the
7878
version-correct workflow.
7979

80+
## Login
81+
82+
The default login does not ask the agent for a Workspace password:
83+
84+
```bash
85+
univer-workspace-cli login
86+
```
87+
88+
The command prints a short-lived Workspace URL and verification code, saves the pending request
89+
locally, and exits immediately. The agent must send the URL and code to the user, then stop and wait
90+
for the user's reply—it must not poll while approval is pending. Open that URL in your own browser,
91+
sign in if necessary, and confirm the matching code. Existing browser sessions and all browser
92+
sign-in methods—including GitHub and Discord—work with this flow.
93+
94+
Only after the user confirms approval, complete the one-time exchange:
95+
96+
```bash
97+
univer-workspace-cli login --complete
98+
```
99+
100+
`--complete` checks once and exits; it does not wait or poll. Approval creates a separate CLI session
101+
without copying the browser cookie or an OAuth access token through the agent.
102+
103+
For compatibility, a user at an interactive terminal can still sign in directly with a Workspace
104+
username and password:
105+
106+
```bash
107+
univer-workspace-cli login --username <name>
108+
```
109+
110+
`--password-stdin` remains available for controlled automation that already owns a password secret.
111+
80112
## License policy
81113

82114
The CLI bundles the same application-owned runtime development license as the

0 commit comments

Comments
 (0)