sitevision-cli 1.0.0-beta.2 → 1.0.0-beta.21

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 (63) hide show
  1. package/dist/app.d.ts +1 -1
  2. package/dist/app.js +59 -8
  3. package/dist/cli.js +96 -39
  4. package/dist/commands/build.js +1 -1
  5. package/dist/commands/deploy.d.ts +2 -2
  6. package/dist/commands/deploy.js +135 -25
  7. package/dist/commands/dev.d.ts +8 -10
  8. package/dist/commands/dev.js +77 -366
  9. package/dist/commands/info.js +2 -2
  10. package/dist/commands/watch.js +5 -23
  11. package/dist/components/AnimatedLogo.js +8 -2
  12. package/dist/components/AuthLoginScreen.d.ts +21 -0
  13. package/dist/components/AuthLoginScreen.js +90 -0
  14. package/dist/components/DevPropertiesForm.d.ts +2 -1
  15. package/dist/components/DevPropertiesForm.js +198 -33
  16. package/dist/components/InfoScreen.js +2 -2
  17. package/dist/components/MainMenu.js +7 -2
  18. package/dist/components/PasswordInput.js +2 -1
  19. package/dist/components/SetupFlow.d.ts +2 -1
  20. package/dist/components/SetupFlow.js +100 -11
  21. package/dist/shell/AddonPicker.d.ts +14 -0
  22. package/dist/shell/AddonPicker.js +54 -0
  23. package/dist/shell/CommandPalette.d.ts +8 -0
  24. package/dist/shell/CommandPalette.js +63 -0
  25. package/dist/shell/ConfigForm.d.ts +36 -0
  26. package/dist/shell/ConfigForm.js +558 -0
  27. package/dist/shell/Frame.d.ts +59 -0
  28. package/dist/shell/Frame.js +134 -0
  29. package/dist/shell/Settings.d.ts +6 -0
  30. package/dist/shell/Settings.js +96 -0
  31. package/dist/shell/Shell.d.ts +9 -0
  32. package/dist/shell/Shell.js +586 -0
  33. package/dist/shell/Tabs.d.ts +36 -0
  34. package/dist/shell/Tabs.js +90 -0
  35. package/dist/shell/actions.d.ts +45 -0
  36. package/dist/shell/actions.js +0 -0
  37. package/dist/types/index.d.ts +44 -5
  38. package/dist/utils/config.d.ts +10 -0
  39. package/dist/utils/config.js +14 -0
  40. package/dist/utils/environments.d.ts +20 -0
  41. package/dist/utils/environments.js +74 -0
  42. package/dist/utils/i18n.d.ts +12 -0
  43. package/dist/utils/i18n.js +279 -0
  44. package/dist/utils/jsonc.d.ts +19 -0
  45. package/dist/utils/jsonc.js +74 -0
  46. package/dist/utils/keychain.d.ts +9 -0
  47. package/dist/utils/keychain.js +54 -0
  48. package/dist/utils/oauth2-auth.d.ts +64 -0
  49. package/dist/utils/oauth2-auth.js +242 -0
  50. package/dist/utils/password-prompt.d.ts +5 -0
  51. package/dist/utils/password-prompt.js +28 -0
  52. package/dist/utils/project-detection.d.ts +105 -6
  53. package/dist/utils/project-detection.js +411 -54
  54. package/dist/utils/session-cookie-auth.d.ts +35 -0
  55. package/dist/utils/session-cookie-auth.js +99 -0
  56. package/dist/utils/sitevision-api.d.ts +64 -5
  57. package/dist/utils/sitevision-api.js +195 -33
  58. package/dist/utils/tasks.d.ts +48 -0
  59. package/dist/utils/tasks.js +371 -0
  60. package/dist/utils/workspace.d.ts +17 -0
  61. package/dist/utils/workspace.js +67 -0
  62. package/package.json +3 -1
  63. package/readme.md +102 -121
package/readme.md CHANGED
@@ -1,158 +1,139 @@
1
1
  # Sitevision CLI
2
2
 
3
- This CLI was largely built on the back of the [sitevision-scripts](https://github.com/sitevision/sitevision-scripts) project.
4
- However, these scripts have some limitations:
5
-
6
- - Clunky for use with environments requiring signed packages
7
- - Clunkly management of credentials and unsecure handling of credentials
8
- - No type safety
9
-
10
- ## Features
11
-
12
- - **Interactive Menu** - Full-screen TUI with arrow key navigation
13
- - **Project Detection** - Automatically detects Sitevision projects
14
- - **Two Modes** - Interactive menu OR direct command execution
15
- - **Automatic Setup** - Guided setup for dev properties and signing credentials
16
- - **Secure Credentials** - Passwords live in the OS keychain (macOS Keychain / Windows Credential Manager / Linux libsecret), never on disk
3
+ `svc` builds, signs and deploys Sitevision apps (WebApp, Widget, RESTApp,
4
+ MCPServer) from a full-screen terminal shell or as plain commands.
5
+
6
+ - **One shell for one app or a whole repo.** Run it inside an app, or at the
7
+ root of a repo with many apps and switch between them. Dev and watch keep
8
+ running in the background.
9
+ - **Three ways to authenticate deploys:** username and password, OAuth2 (PKCE,
10
+ works with SSO), or a captured browser session for SAML-only sites.
11
+ - **No secrets on disk.** Passwords, tokens and cookies live in the OS keychain.
12
+ - **Environments.** dev, test and prod in one config; production deploys use
13
+ the signed zip, confirm and activate.
14
+ - **Shared config in git.** Site and auth settings for the whole team live in
15
+ `package.json`, once at the repo root; your username stays in a local
16
+ `.dev_properties.json`. Compatible with plain sitevision-scripts.
17
+ - **Builds the way Sitevision does.** Bundled apps without their own webpack
18
+ config are built by `@sitevision/sitevision-scripts`.
19
+ - English and Swedish UI.
20
+
21
+ 📖 **[User guide](docs/user-guide.md)** · **[Användarguide (svenska)](docs/anvandarguide.md)**
17
22
 
18
23
  ## Install
19
24
 
25
+ Requires Node.js 22+.
26
+
20
27
  ```bash
21
28
  npm install --global sitevision-cli
22
29
  ```
23
30
 
24
- ## Usage
25
-
26
- The CLI must be run inside a Sitevision project directory (containing a `manifest.json`).
27
-
28
- ### Interactive Mode
29
-
30
- Simply run `svc` to launch the interactive menu:
31
+ ## Quick start
31
32
 
32
33
  ```bash
34
+ cd my-repo # or cd into a single app
33
35
  svc
34
36
  ```
35
37
 
36
- On first run (or if setup is incomplete), the CLI will:
37
-
38
- 1. Check if `node_modules` exists and offer to run `npm install` if missing
39
- 2. Check if dev properties are configured and offer to set them up if missing
40
- 3. Check if you have setup signing credentials and offer to do so if missing
41
- 4. Display project information
42
- 5. Show the main menu
43
-
44
- Use arrow keys to navigate and Enter to select:
45
-
46
- - **Dev** - Start development server with watch mode
47
- - **Dev (Signed)** - Development with automatic signing before each deploy
48
- - **Build** - Build a dist bundle
49
- - **Sign** - Sign built dist bundle
50
- - **Deploy** - Deploy to configured development environment
51
- - **Deploy (Force)** - Force deploy (overwrite existing)
52
- - **Deploy Production** - Deploy signed app to configured production environment
53
- - **Info** - Show project info
54
- - **Exit**
55
-
56
- ### Direct Commands
57
-
58
- You can also run commands directly:
59
-
60
- #### Development
61
-
62
- ```bash
63
- # Start development server with watch mode
64
- svc dev
65
-
66
- # Start development server with automatic signing
67
- svc dev --signed
68
- ```
69
-
70
- #### Building
38
+ 1. Pick an app in the navigator and press `Enter`. (In a new repo the shell
39
+ opens on **Workspace settings** first.)
40
+ 2. Press `2` for the **Config** tab and fill in domain, site name, addon name,
41
+ username and auth method. Each field saves on `Enter`.
42
+ 3. Press `i` to install dependencies if needed, then `d` to start dev: build on
43
+ every change and deploy. Output is in the **Log** tab (`4`).
44
+
45
+ For production: switch environment with `E`, press `b` to build, `s` to sign
46
+ and `p` to deploy and activate.
47
+
48
+ ## The shell
49
+
50
+ | Key | Action |
51
+ | --------------- | --------------------------------------------------- |
52
+ | `d` / `w` | Dev (build + deploy on change) / Watch (build only) |
53
+ | `b` / `s` | Build / Sign |
54
+ | `p` / `P` | Deploy / force deploy to the active environment |
55
+ | `a` | Versions: list and activate uploaded versions |
56
+ | `E` | Switch environment |
57
+ | `e` / `y` / `i` | Config tab / sync `package.json` / `npm install` |
58
+ | `l` | Log in again |
59
+ | `K` | Stop running tasks |
60
+ | `1`–`4` | Overview · Config · Versions · Log |
61
+ | `/` | Command palette |
62
+ | `,` | Settings (language, intro animation) |
63
+ | `Tab` / `Esc` | Switch pane / back |
64
+ | `q` | Quit |
65
+
66
+ In the navigator, typing filters the app list; action keys work once `Enter` or
67
+ `Tab` has moved focus to the content pane. The bottom bar always shows the keys
68
+ that apply. `svc --minimal` gives a compact layout for small panes.
69
+
70
+ ## Commands
71
71
 
72
72
  ```bash
73
- # Build the application for production
74
- svc build
73
+ svc # interactive shell
74
+ svc build # build to dist/<id>.zip
75
+ svc sign # sign to dist/<id>-signed.zip
76
+ svc deploy [--force] # deploy the zip
77
+ svc deploy --production [--activate] # deploy the signed zip
78
+ svc dev [--signed] # build + deploy on change
79
+ svc watch [--signed] # build on change, no deploy
80
+ svc info # project information
75
81
  ```
76
82
 
77
- #### Signing
78
-
79
- ```bash
80
- # Sign the app for production deployment
81
- svc sign
82
- ```
83
-
84
- #### Deployment
85
-
86
- ```bash
87
- # Deploy to development server
88
- svc deploy
89
-
90
- # Force deploy (overwrite existing)
91
- svc deploy --force
92
-
93
- # Deploy to production (requires signed app)
94
- svc deploy --production
95
- ```
96
-
97
- #### Setup
98
-
99
- ```bash
100
- # Configure signing credentials
101
- svc setup-signing
102
- ```
103
-
104
- #### Project Info
105
-
106
- ```bash
107
- # Show project information and configuration
108
- svc info
109
- ```
83
+ Direct commands use the base environment. `--token` and `--cookie` pass an
84
+ OAuth2 token or session cookie for one run.
110
85
 
111
86
  ## Configuration
112
87
 
113
- ### Development Properties (`.dev_properties.json`)
114
-
115
- Create this file in your project root for deployment configuration:
88
+ `.dev_properties.json` is your local config and the main source; keep it out of
89
+ git. Shared values are committed in `package.json` and act as defaults
90
+ underneath it:
116
91
 
117
92
  ```json
118
93
  {
119
- "domain": "your-site.sitevision.se",
120
- "siteName": "YourSite",
121
- "addonName": "your-addon",
122
- "username": "your-email@example.com",
123
- "useHTTPForDevDeploy": false,
124
- "signingUsername": "your-developer-account@example.com",
125
- "certificateName": "optional-certificate-name"
94
+ "developmentDomain": "acme-use.sitevision-cloud.se",
95
+ "siteName": "Intranet",
96
+ "addonName": "my-addon",
97
+ "svc": {
98
+ "authMethod": "oauth2",
99
+ "environments": {"prod": {"domain": "acme.sitevision-cloud.se"}}
100
+ }
126
101
  }
127
102
  ```
128
103
 
129
- ### Password storage
104
+ `username`, `signingUsername` and `certificateName` are user-specific and only
105
+ live in `.dev_properties.json`. `y` copies shared values from
106
+ `.dev_properties.json` into `package.json`. In a workspace, shared values go in
107
+ the root `package.json` and each app's `package.json` only needs `addonName`.
108
+
109
+ ## Authentication in short
130
110
 
131
- Passwords are stored in the OS-native secret store (macOS Keychain, Windows
132
- Credential Manager, Linux libsecret) under the `sitevision-cli` service —
133
- never in `.dev_properties.json`. Run `svc` and complete the setup form (or
134
- enter the password when prompted at deploy/sign time and toggle "save to
135
- keychain") to populate it.
111
+ There are two separate credentials:
136
112
 
137
- If an existing `.dev_properties.json` contains a plaintext `password` field,
138
- the CLI offers to migrate it to the keychain on next launch and strip the
139
- field from the file. The migration prompt only appears in interactive mode
140
- (plain `svc`) — if you only ever invoke commands directly (`svc deploy`,
141
- `svc dev`), run `svc` once to migrate.
113
+ - **Deploy**: your account on the site. `authMethod` is `basic` (password),
114
+ `oauth2` (browser login against the site's OAuth2 provider, refreshed
115
+ silently afterwards) or `cookie` (log in with SSO in a Chrome window, the
116
+ session is captured).
117
+ - **Signing**: your developer.sitevision.se account, always username and
118
+ password.
142
119
 
143
- For CI / headless use, set `SITEVISION_DEPLOY_PASSWORD` and/or
144
- `SITEVISION_SIGNING_PASSWORD` — these take precedence over the keychain and
145
- are never written anywhere.
120
+ Everything secret goes in the OS keychain under `sitevision-cli`. For CI, set
121
+ `SITEVISION_DEPLOY_PASSWORD`, `SITEVISION_SIGNING_PASSWORD`,
122
+ `SITEVISION_ACCESS_TOKEN` or `SITEVISION_SESSION_COOKIE`.
146
123
 
147
- ### Signing Credentials
124
+ OAuth2 needs a client registered on the site with the redirect URI
125
+ `http://127.0.0.1:8137/callback`. The [user guide](docs/user-guide.md#5-authentication)
126
+ covers the setup, the pitfalls, and which method works with which command.
148
127
 
149
- Signing credentials are used to sign apps via developer.sitevision.se:
128
+ ## Development
150
129
 
151
- - `signingUsername` - Your developer.sitevision.se account
152
- - `certificateName` - Optional, if you have multiple certificates
130
+ ```bash
131
+ npm install
132
+ npm run build # tsc → dist/
133
+ npm test # prettier, xo, ava
134
+ ```
153
135
 
154
- The signing password is prompted on first use, with an option to save it to
155
- the OS keychain for future runs.
136
+ Releasing: see [RELEASING.md](RELEASING.md).
156
137
 
157
138
  ## License
158
139