wcz-layout 9.6.6 → 10.0.0

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 (94) hide show
  1. package/dist/AggregatedCell-BtKC5-m6.mjs +497 -0
  2. package/dist/AggregatedCell-BtKC5-m6.mjs.map +1 -0
  3. package/dist/Approval-C-hF4jbT.mjs.map +1 -1
  4. package/dist/DialogsContext-DLqA8RJ_.mjs.map +1 -1
  5. package/dist/Email-BzQQkbe9.mjs.map +1 -1
  6. package/dist/FileMeta-DDqUju1Y.mjs.map +1 -1
  7. package/dist/LayoutTable-4DLs-NI-.d.mts +752 -0
  8. package/dist/{QueryClientParam-Cbb0MIKg.d.mts → QueryClientParam-JcH0mJWl.d.mts} +2 -2
  9. package/dist/RouterListItemButton-ULMlaQh6.mjs.map +1 -1
  10. package/dist/{User-1gKoYJvW.d.mts → User-D4__w1I1.d.mts} +4 -2
  11. package/dist/approval-DFExxyAJ.mjs +84 -0
  12. package/dist/approval-DFExxyAJ.mjs.map +1 -0
  13. package/dist/auth.d.mts +21 -11
  14. package/dist/auth.mjs +43 -26
  15. package/dist/auth.mjs.map +1 -1
  16. package/dist/components.d.mts +22 -30
  17. package/dist/components.mjs +792 -145
  18. package/dist/components.mjs.map +1 -1
  19. package/dist/createApi-CLYWCzR2.mjs +27 -0
  20. package/dist/createApi-CLYWCzR2.mjs.map +1 -0
  21. package/dist/data/client.d.mts +703 -1152
  22. package/dist/data/client.mjs +4 -3
  23. package/dist/data/client.mjs.map +1 -1
  24. package/dist/data/server.d.mts +3 -3
  25. package/dist/data/server.mjs +4 -2
  26. package/dist/data/server.mjs.map +1 -1
  27. package/dist/{file-BTFDDalH.mjs → file-CZwQfvTU.mjs} +8 -27
  28. package/dist/file-CZwQfvTU.mjs.map +1 -0
  29. package/dist/{file-CuvAmdJW.mjs → file-aSQto2rw.mjs} +7 -9
  30. package/dist/file-aSQto2rw.mjs.map +1 -0
  31. package/dist/hooks.d.mts +7 -46
  32. package/dist/hooks.mjs +2578 -239
  33. package/dist/hooks.mjs.map +1 -1
  34. package/dist/index.d.mts +29 -9
  35. package/dist/index.mjs +1257 -499
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/middleware.d.mts +20 -19
  38. package/dist/middleware.mjs +47 -2
  39. package/dist/middleware.mjs.map +1 -1
  40. package/dist/models.d.mts +17 -10
  41. package/dist/models.mjs.map +1 -1
  42. package/dist/{peoplesoft-D4w8d4s1.d.mts → peoplesoft-BY_75WTS.d.mts} +3 -2
  43. package/dist/{peoplesoft-DGdM1bws.mjs → peoplesoft-CQnc01Hc.mjs} +24 -81
  44. package/dist/peoplesoft-CQnc01Hc.mjs.map +1 -0
  45. package/dist/providers-Dbl95AxR.mjs +74 -0
  46. package/dist/providers-Dbl95AxR.mjs.map +1 -0
  47. package/dist/tokens-D8CVIFTb.mjs +143 -0
  48. package/dist/tokens-D8CVIFTb.mjs.map +1 -0
  49. package/dist/{utils-5x4uNxsX.d.mts → utils-Bhi0KiBx.d.mts} +18 -6
  50. package/dist/{utils-DjdexspV.mjs → utils-KaM5VMTJ.mjs} +64 -42
  51. package/dist/utils-KaM5VMTJ.mjs.map +1 -0
  52. package/dist/utils.d.mts +2 -2
  53. package/dist/utils.mjs +2 -2
  54. package/dist/vite.d.mts +1 -2
  55. package/dist/vite.mjs +3 -3
  56. package/dist/vite.mjs.map +1 -1
  57. package/package.json +128 -127
  58. package/skills/client-db/SKILL.md +104 -96
  59. package/skills/db-schema/SKILL.md +46 -33
  60. package/skills/dialogs/SKILL.md +21 -27
  61. package/skills/forms/SKILL.md +60 -39
  62. package/skills/general/SKILL.md +125 -94
  63. package/skills/general/references/exports.md +106 -0
  64. package/skills/migrations/SKILL.md +57 -0
  65. package/skills/migrations/versions/migrate-v9-to-v10.md +581 -0
  66. package/skills/routing/SKILL.md +50 -60
  67. package/skills/server-functions/SKILL.md +36 -56
  68. package/skills/services/SKILL.md +34 -31
  69. package/skills/services/docs/approval.md +2 -2
  70. package/skills/services/docs/peoplesoft.md +1 -1
  71. package/skills/start/SKILL.md +51 -47
  72. package/skills/start/steps/01-git-setup.md +0 -1
  73. package/skills/start/steps/04-wicop-setup.md +105 -80
  74. package/skills/start/steps/05-database-setup.md +13 -5
  75. package/skills/start/steps/06-entra-setup.md +96 -98
  76. package/skills/start/steps/07-vault-setup.md +57 -24
  77. package/skills/table/SKILL.md +275 -0
  78. package/skills/unslop/SKILL.md +80 -0
  79. package/dist/NotificationContext-CgwUOeW0.mjs +0 -7
  80. package/dist/NotificationContext-CgwUOeW0.mjs.map +0 -1
  81. package/dist/authMiddleware-DPly0b_T.mjs +0 -48
  82. package/dist/authMiddleware-DPly0b_T.mjs.map +0 -1
  83. package/dist/entra-CJSyeQsx.mjs +0 -109
  84. package/dist/entra-CJSyeQsx.mjs.map +0 -1
  85. package/dist/file-BTFDDalH.mjs.map +0 -1
  86. package/dist/file-CuvAmdJW.mjs.map +0 -1
  87. package/dist/msalServer-DLwA7_ta.mjs +0 -30
  88. package/dist/msalServer-DLwA7_ta.mjs.map +0 -1
  89. package/dist/peoplesoft-DGdM1bws.mjs.map +0 -1
  90. package/dist/useDialogs-BUzVrTSP.mjs +0 -248
  91. package/dist/useDialogs-BUzVrTSP.mjs.map +0 -1
  92. package/dist/user-Dzv0N9fj.d.mts +0 -16
  93. package/dist/utils-DjdexspV.mjs.map +0 -1
  94. package/skills/data-grid/SKILL.md +0 -142
@@ -1,80 +1,105 @@
1
- # WiCOP Setup
2
-
3
- Ask the user only through the **AskUserQuestion** pop-up, never as chat text
4
- waiting for a typed reply, and never with a single `Continue`-style option —
5
- that is a wait, not a question. Ask only when there is a real choice, always
6
- with at least two concrete options; enable free text only for open-ended
7
- values (cost center, employee ID), not for yes/no decisions.
8
-
9
- To wait for something the user does in the browser, poll in a tool loop:
10
- wait ~5 s, re-read the page, repeat until the expected state appears or ~5
11
- minutes pass, then carry straight on. Never end your turn while waiting —
12
- announcing "I'll continue once you have signed in" and stopping ends the
13
- session, and nothing resumes it.
14
-
15
- 1. Open [WiCOP](https://wicop.wistron.com/). If the sign-in page appears, do
16
- not ask for any application-form values yet. Say in one line that the user
17
- should finish the Microsoft sign-in, then poll (wait, re-read, repeat)
18
- inside the same turn until the signed-in shell is visible — the user name
19
- in the header and the left navigation — and continue without asking.
20
- 2. Open **Application Forms > New Account Combo Flow > Start**. Select **New
21
- Account Combo**, set **Purpose** to `Initialization of a new application.`,
22
- and select **OK**.
23
- 3. On **IBU Apply**, ask via **AskUserQuestion** for the **Cost Center** and
24
- whether to create **QAS**, **PRD**, or both. Fill the form sequentially from top to bottom;
25
- never interact with a field while a required field above it is incomplete.
26
- Leave prefilled and unneeded fields unchanged. The controls appear on the
27
- page in this order — use these values as each one is reached:
28
- - **I already have an IBU**: keep `No, apply a new IBU`. **IBU Group
29
- (Service Name)** is generated from the fields below; never type into it.
30
- - _Cloud Environment_
31
- - Service Provider: `K8S`
32
- - Application Name (EA ID): the user selects it — see step 4
33
- - Service(System) Alias Name: read `package.json` `name` converted to
34
- uppercase letters and digits only, with spaces and punctuation removed
35
- (`my-app` becomes `MYAPP`)
36
- - Cloud Type: `Satellite Cloud`
37
- - Cloud Site / Plant: `WCZ` / `WCZ`
38
- - Environment: tick only the requested boxes (DEV, QAS, PRD in that
39
- order); each ticked box enables its own **Cloud Cluster ID** and
40
- **Budget (TWD)** below it
41
- - QAS cluster / budget: `wcz-sat-qas-01` / `0`
42
- - PRD cluster / budget: `wcz-sat-prd-01` / `0`
43
- - _Owner information_
44
- - Cost Center: the user-provided value, entered in the editable IBU
45
- control, not the prefilled read-only IBG control
46
- - _Charge Setting_
47
- - Charge Type: `By Fixed Amount (per IBU)`
48
- - Charge Groups: reuse the same Cost Center if its row asks for one
49
- 4. When **Application Name (EA ID)** is reached, leave it entirely to the
50
- user: do not type, search, or select a value. Say in one line that the user
51
- should pick the EA ID, then poll the field until it holds a value and
52
- resume filling the form sequentially. Select **Next >** when complete.
53
- 5. On **IBG Apply**, verify the inherited read-only values and select
54
- **Next >**.
55
- 6. On **Project Apply**, set **Memory (GB)** to `2` for each selected
56
- environment; leave other fields unchanged. Ask via **AskUserQuestion**
57
- before selecting **Next >**.
58
- 7. On **Team Apply**, ask via **AskUserQuestion** for the GitLab team manager's
59
- name or ID.
60
- Populate all other team fields automatically. Add `C0708003`, `C1107048`,
61
- `C2503017`, `C2404003`, `C2404002`, and `C2508015` as GitLab members,
62
- excluding the selected manager from the member list. Use **Copy & Paste
63
- Now** for all other teams. Create a JSM team and select its license-charge
64
- agreement when requested, then copy the GitLab team to it. Do not add a
65
- member row after the final member.
66
- 8. On **Review & Confirm**, present the summary to the user, then ask via
67
- **AskUserQuestion**: **"Submit the WiCOP request?"** with options `Submit` /
68
- `Not yet`. Only after they select `Submit`, select **Submit**; in the dialog,
69
- accept the CCoE Policy and select **Confirm**. On the successful-submission
70
- dialog, select **Let's Go** to open **Apply Status**.
71
- 9. Close the current browser session.
72
-
73
- This applies on every page and to every advancing control (**OK**, **Next >**,
74
- **Submit**, **Confirm**, **Let's Go**): after selecting it, inspect the next
75
- step and continue the workflow without pausing unless user input, a required
76
- confirmation, or a final submission decision is needed. If the UI does not
77
- visibly advance, select the same control once more, then stop.
78
-
79
- Do not submit the final request without the user's confirmation. WiCOP sends
80
- the application to the manager, owner, and owner division head for approval.
1
+ # WiCOP Setup
2
+
3
+ Ask the user only through the **AskUserQuestion** pop-up, never as chat text
4
+ waiting for a typed reply, and never with a single `Continue`-style option —
5
+ that is a wait, not a question. Ask only when there is a real choice, always
6
+ with at least two concrete options; enable free text only for open-ended
7
+ values (cost center, employee ID), not for yes/no decisions.
8
+
9
+ To wait for something the user does in the browser, poll in a tool loop:
10
+ wait ~5 s, re-check, repeat until the expected state appears or ~5 minutes
11
+ pass, then carry straight on. Never end your turn while waiting —
12
+ announcing "I'll continue once you have signed in" and stopping ends the
13
+ session, and nothing resumes it. Poll cheaply: a full page read returns the
14
+ entire sidebar and is tens of kilobytes, so when you are waiting on one
15
+ field, screenshot that field's ref instead. Element refs stay valid across
16
+ re-renders, so reuse the ones you already have rather than re-reading the
17
+ page to rediscover them.
18
+
19
+ 1. Open [WiCOP](https://wicop.wistron.com/). If the sign-in page appears, do
20
+ not ask for any application-form values yet. Say in one line that the user
21
+ should finish the Microsoft sign-in, then poll inside the same turn until
22
+ the URL returns to `wicop.wistron.com`. While the sign-in pages are open,
23
+ poll the page title and URL only — never read the page content, because the
24
+ password the user types is exposed in the accessibility snapshot. Once back
25
+ on WiCOP, confirm the signed-in shell (user name in the header, left
26
+ navigation) and continue without asking.
27
+ 2. Navigate directly to
28
+ `https://wicop.wistron.com/wicop/applicationForms/newAccountComboFlow` —
29
+ the collapsed left-nav submenu intercepts pointer events and clicking its
30
+ links times out. Select **Start**, then **New Account Combo**, set
31
+ **Purpose** to `Initialization of a new application.`, and select **OK**.
32
+ 3. On **IBU Apply**, ask via **AskUserQuestion** for the **Cost Center** and
33
+ whether to create **QAS**, **PRD**, or both. Fill the form sequentially from top to bottom;
34
+ never interact with a field while a required field above it is incomplete.
35
+ Leave prefilled and unneeded fields unchanged. The controls appear on the
36
+ page in this order — use these values as each one is reached:
37
+ - **I already have an IBU**: keep `No, apply a new IBU`. **IBU Group
38
+ (Service Name)** is generated from the fields below; never type into it.
39
+ - _Cloud Environment_
40
+ - Service Provider: `K8S`
41
+ - Application Name (EA ID): search for it yourself first — see step 4
42
+ - Service(System) Alias Name: read `package.json` `name` converted to
43
+ uppercase letters and digits only, with spaces and punctuation removed
44
+ (`my-app` becomes `MYAPP`); the field accepts at most 16 characters
45
+ - Cloud Type: `Satellite Cloud`
46
+ - Cloud Site: `WCZ`
47
+ - Plant: `WCZ` — this control only appears once Cloud Type is
48
+ `Satellite Cloud`, below Cloud Site
49
+ - Environment: tick only the requested boxes; the list is filtered by
50
+ site, so WCZ Satellite offers QAS and PRD only. Each ticked box
51
+ enables its own **Cloud Cluster ID** and **Budget (TWD)** below it
52
+ - QAS cluster / budget: `wcz-sat-qas-01` / `0`
53
+ - PRD cluster / budget: `wcz-sat-prd-01` / `0`
54
+ - _Owner information_
55
+ - Cost Center: the user-provided value, entered in the editable IBU
56
+ control, not the prefilled read-only IBG control
57
+ - _Charge Setting_
58
+ - Charge Type: `By Fixed Amount (per IBU)`
59
+ - Charge Groups: reuse the same Cost Center if its row asks for one
60
+ 4. When **Application Name (EA ID)** is reached, try to find it yourself. The
61
+ registered application names follow no convention — they may differ from
62
+ `package.json` `name` in casing, spacing, punctuation, and wording (`My
63
+ App`, `MyApp`, `My Application`, or an unrelated label), so do not expect an
64
+ exact match. Click the field first — it only starts searching once focused —
65
+ then type only a few leading characters of the most likely name to get a
66
+ wide option list. The options are loaded lazily, so wait and re-check the
67
+ list until it appears instead of concluding there are no matches; read the
68
+ options and select the one that clearly matches the project. Make a few
69
+ attempts with different guesses (short
70
+ prefix, the words separately, the full name). If no option is clearly the
71
+ right one, clear the field, say in one line that the user should pick the EA
72
+ ID, then poll the field until it holds a value. Resume filling the form
73
+ sequentially and select **Next >** when complete.
74
+ 5. On **IBG Apply**, verify the inherited read-only values and select
75
+ **Next >**. This page routinely needs the click twice.
76
+ 6. On **Project Apply**, set **Memory (GB)** to `2` for each selected
77
+ environment; leave other fields unchanged. Ask via **AskUserQuestion**
78
+ before selecting **Next >**.
79
+ 7. On **Team Apply**, ask via **AskUserQuestion** who the GitLab team manager
80
+ is, offering exactly two options: `Martin Husar (C1107048)` and the
81
+ logged-in user — read that ID and name from the top-right corner of the
82
+ WiCOP header.
83
+ Populate all other team fields automatically. Add `C0708003`, `C1107048`,
84
+ `C2503017`, `C2404003`, `C2404002`, and `C2508015` as GitLab members,
85
+ excluding the selected manager from the member list. Each member box is a
86
+ search field: type the ID, then select the suggestion it offers before
87
+ adding the next row — an unresolved ID is discarded. Use **Copy & Paste
88
+ Now** for all other teams. Create a JSM team and select its license-charge
89
+ agreement when requested, then copy the GitLab team to it. Do not add a
90
+ member row after the final member.
91
+ 8. On **Review & Confirm**, present the summary to the user, then ask via
92
+ **AskUserQuestion**: **"Submit the WiCOP request?"** with options `Submit` /
93
+ `Not yet`. Only after they select `Submit`, select **Submit**; in the dialog,
94
+ accept the CCoE Policy and select **Confirm**. On the successful-submission
95
+ dialog, select **Let's Go** to open **Apply Status**.
96
+ 9. Close the current browser session.
97
+
98
+ This applies on every page and to every advancing control (**OK**, **Next >**,
99
+ **Submit**, **Confirm**, **Let's Go**): after selecting it, inspect the next
100
+ step and continue the workflow without pausing unless user input, a required
101
+ confirmation, or a final submission decision is needed. If the UI does not
102
+ visibly advance, select the same control once more, then stop.
103
+
104
+ Do not submit the final request without the user's confirmation. WiCOP sends
105
+ the application to the manager, owner, and owner division head for approval.
@@ -1,6 +1,8 @@
1
1
  # Database Setup
2
2
 
3
3
  > Create `.env.local` if it does not exist.
4
+ > The app pins `search_path` to the `DATABASE_URL` username, so a schema with that
5
+ > exact name must exist. `public` cannot be a username — it is a reserved role.
4
6
 
5
7
  ## User Input
6
8
 
@@ -8,11 +10,12 @@ Ask via **AskUserQuestion**: **"Do you already have a Postgres database created
8
10
 
9
11
  ## Branch A — Existing database
10
12
 
11
- 1. Ask: **"Please provide the database connection details**.
13
+ 1. Ask: **"Please provide the database connection details"**.
14
+
15
+ Fill the host in automatically — QAS is always `10.82.36.60:5432`, PRD is always `10.82.36.50:5432`.
12
16
 
13
17
  2. Update `.env.local`:
14
18
  - Set `DATABASE_URL=postgres://<schema-username>:<password>@<server-address>:5432/<database-name>`.
15
- - Set `DATABASE_SCHEMA=<schema-username>`.
16
19
 
17
20
  ## Branch B — No database
18
21
 
@@ -37,8 +40,13 @@ docker run --name <project-name>-postgres -e POSTGRES_PASSWORD=<password> -d -p
37
40
  - **Success** → continue.
38
41
  - **Error** → stop and show the full error to the user.
39
42
 
40
- 5. Update `.env.local`:
43
+ 5. Create the schema matching the username:
44
+
45
+ ```powershell
46
+ docker exec <project-name>-postgres psql -U postgres -c "CREATE SCHEMA IF NOT EXISTS postgres AUTHORIZATION postgres;"
47
+ ```
48
+
49
+ 6. Update `.env.local`:
41
50
  - Set `DATABASE_URL=postgres://postgres:<password>@localhost:<PORT>/postgres`.
42
- - Set `DATABASE_SCHEMA=public`.
43
- 6. Output exactly:
51
+ 7. Output exactly:
44
52
  > ✅ Local Postgres database created successfully on port [PORT]
@@ -1,98 +1,96 @@
1
- # Entra ID Setup
2
-
3
- Ask the user only through the **AskUserQuestion** pop-up, never as chat text
4
- waiting for a typed reply, and never with a single `Continue`-style option —
5
- that is a wait, not a question. Ask only when there is a real choice, always
6
- with at least two concrete options; enable free text only for open-ended
7
- values (client ID, user count), not for yes/no decisions.
8
-
9
- To wait for something the user does in the browser — signing in, filling a
10
- field, clicking Submit — poll in a tool loop: wait ~5 s, re-read the page,
11
- repeat until the expected state appears or ~5 minutes pass, then carry
12
- straight on. Never end your turn while waiting; announcing "I'll continue
13
- once you have signed in" and stopping ends the session, and nothing resumes
14
- it. A page that renders blank is usually still loading or still on the
15
- sign-in gate — keep polling instead of reporting it as a problem.
16
-
17
- ---
18
-
19
- ## Part A — Application Creation
20
-
21
- Ask via **AskUserQuestion**: **"Is the Entra ID application already created for this project?"** — options `Yes` / `No`.
22
-
23
- - **Yes** → proceed to Part B.
24
- - **No** → Open `https://itsr.wistron.com/homepage/apply` in the browser and perform the request with the user:
25
-
26
- 1. Select Service Type → Azure AD - Application Management - Add or Modify → Submit.
27
- 2. Select Add Application → Add Applicant.
28
- 3. Fill in the required application details:
29
- - Set the English application name from the chat context. Do not ask the user for it. If it is absent from the context, read the `name` property in `package.json`, convert it to spaced Pascal Case, and prefix it with `WCZ` (for example, `my-project` becomes `WCZ My Project`).
30
- - Write a concise, single-sentence reason for creating the application based on its name and purpose. Do not ask the user for this.
31
- - Ask via **AskUserQuestion** for the expected user count, and separately: **"Who can reach the app?"** — options `Internal network only (OA)` / `Also from the public internet`. Do not choose either value on their behalf. In the ITSR form, `Internal network only` is the OA-restricted choice.
32
- - Ask via **AskUserQuestion** for the application manager's employee ID, alongside the questions above, with free text enabled. Then use the form's search control to resolve and select that person.
33
- 4. Once every field is filled, click Submit yourself to add the applicant. The applicant appears in the page's summary table and enables the page-level final Submit.
34
- 5. On the summary page, ask via **AskUserQuestion**: **"Submit the ITSR request?"** — options `Submit` / `Add another application`.
35
- - `Add another application` → click **+ Add Applicant** above the summary table, fill the dialog exactly as in step 3, submit the dialog so the new row joins the table, then return to this question. Ask again for the new application's name, its expected user count, and its access scope — these are unique per application, so never carry them over from an existing row. Write its reason yourself.
36
- - `Submit` → click the page-level final Submit and confirm the portal accepted the request.
37
-
38
- Repeat until the user answers `Submit`. Only that answer may trigger the final Submit — the request goes to approvers.
39
-
40
- When the portal needs sign-in, poll until the ITSR request form is visible and continue — do not end the turn.
41
-
42
- Once the request is submitted, close the ITSR browser session, **skip Part B**, and continue to the next step — the applications do not exist until the request is approved.
43
-
44
- ---
45
-
46
- ## Part B — Application Configuration
47
-
48
- Ask via **AskUserQuestion**: **"Have you configured the Entra ID application settings?"** — options `Yes` / `No`.
49
-
50
- - **Yes** → skip to **Credentials** below.
51
- - **No** → Open `https://entra.microsoft.com/` and complete every Part B step in one uninterrupted run. Reuse this signed-in tab and the portal's own navigation; for slow controls, poll and re-read the current blade instead of reloading or opening another tab. Derive every value from the app name and the fixed values below. Do not ask for owners; the owner list is fixed. Ask only before an explicitly user-approved irreversible action.
52
-
53
- Gradually write all the data to `.env.local` with exactly these keys — keep any values already set by earlier steps (if this file does not exist, create it). If empty - fill `SESSION_SECRET` with a freshly generated value, and leave the rest empty until you know the values:
54
-
55
- ```dotenv
56
- ENTRA_CLIENT_ID=
57
- ENTRA_TENANT_ID=
58
- ENTRA_CLIENT_SECRET=
59
- SESSION_SECRET=<generated-64-char-hex>
60
- ```
61
-
62
- **Left navigation: App Registrations:**
63
-
64
- 1. Use the application's display name already present in chat context. Ask via **AskUserQuestion** only if it is genuinely absent; otherwise open **App registrations**, filter by the exact name, and click the matching row. Its **Overview** page shows **Application (client) ID** and **Directory (tenant) ID** — read both and write them to `.env.local` as `ENTRA_CLIENT_ID` and `ENTRA_TENANT_ID` straight away, before configuring anything else. Never ask the user for these two values. Leave `ENTRA_CLIENT_SECRET` empty only until the client secret is created in step 3.
65
- 2. **Authentication (Preview)** — the left-nav item is named that, and it opens on the **Redirect URI configuration** tab. Three URIs are needed, where `<app-name>` is the `name` from `package.json`:
66
- - `http://localhost:3000/auth/callback`
67
- - `https://<app-name>.wcz-sat-qas-01.k8s.wistron.com/auth/callback`
68
- - `https://<app-name>.wcz-sat-prd-01.k8s.wistron.com/auth/callback`
69
-
70
- The portal only accepts them one panel at a time:
71
-
72
- a. **+ Add Redirect URI** → platform picker → **Web** → **Select**. The login flow is server-side (confidential client), so never pick **Single-page application**.
73
- b. The panel takes a single URI. Enter the localhost one and click **Configure**. A success toast appears and the platform picker reopens — click **Cancel** to return to the list.
74
- c. The list now shows a **Web** group row with an **Edit** link. Click **Edit**: the panel lists the saved URIs plus one empty row, and filling a row spawns another empty row below it. Add the `qas` and `prd` URIs, then click **Configure**.
75
- d. Verify all three appear as Web rows in the list.
76
-
77
- 3. **Certificates & secrets:** open the **Client secrets** tab → **+ New client secret**. Leave **Description** empty and set **Expires** to `730 days (24 months)` — always these values, never ask the user — then click **Add**. Read the new row's **Secret ID** and write it into `ENTRA_CLIENT_SECRET` in `.env.local` before navigating anywhere else. Never print the secret ID in chat or in a commit.
78
- 4. **Token configuration:** click **Add groups claim**. In the panel tick **Security groups** only, then expand each of **ID**, **Access**, and **SAML** in "Customize token properties by type" and switch the radio from `Group ID` to `sAMAccountName`. Click **Add**. The list should then show a `groups` claim with token type `ID, Access, SAML`.
79
- 5. **Expose an API:** next to **Application ID URI** click **Add** (or **Edit** if one exists). The portal prefills `api://<client-id>` — replace it with `api://wistron.com/<app-name>` (for `wh-fg-preparation`: `api://wistron.com/wh-fg-preparation`) and **Save**. Then **+ Add a scope** named `access_as_user`, set **Who can consent?** to `Admins and users`, and fill only the two required fields — **Admin consent display name** and **Admin consent description**. Leave the user consent fields empty (optional) and **State** on `Enabled`, then click **Add scope**. Do not navigate away or report progress as complete until the saved `api://wistron.com/<app-name>` URI and enabled `access_as_user` scope are both visible in the portal.
80
- 6. **Owners:** first read the current table once. Add only missing people from this fixed list: Radim Staworowski, Martin Husar, Dalibor Homola, Patrik Lorenc, Tien Thanh Tran, Sebastian Ondruska. In the picker, search each missing full name, wait for the exact name and Wistron UPN match, select it, then replace the search text with the next name without closing the picker. Submit the batch once and verify all six names in the refreshed table.
81
- 7. **Manifest:** the page opens the **Microsoft Graph App Manifest (New)** JSON in a code editor. Inside the `api` object change `"acceptMappedClaims": null` to `true` and `"requestedAccessTokenVersion": null` to `2`, then click **Save**.
82
-
83
- **Left navigation: Enterprise Applications:**
84
-
85
- 1. Open **Enterprise apps → All applications** and search with the exact display name already resolved in App Registrations; do not ask for it again.
86
- 2. **Owners:** repeat the batched owner process from App Registrations. Inspect the table once, keep the picker open while searching and selecting every missing exact Wistron record, and confirm the selected-user count increments after each selection. Click **Select** once, wait for `Owner assignment succeeded`, then verify all six names in the refreshed table. The toolbar and table may load after the heading; keep polling until both appear.
87
- 3. **Single sign-on** opens as **OIDC-based Sign-on**; there is no SAML wizard. Wait for the embedded OIDC content, then click the visible **Edit** pencil under **② Attributes & Claims**. If its reference is stale, re-read this page and click the new reference. Ignore background `400`/`403` console messages while the requested controls remain usable. Confirm the claims list already holds `groups → user.groups`, then add each missing row with **+ Add new claim**:
88
-
89
- | Claim Name | Source Attribute |
90
- | ------------------ | --------------------------- |
91
- | `department` | `user.department` |
92
- | `employeeId` | `user.extensionattribute5` |
93
- | `employeeCategory` | `user.extensionattribute13` |
94
- | `companyName` | `user.companyname` |
95
-
96
- For each one: type the claim name in **Name** and leave **Source** on `Attribute`. **Source attribute** is a dropdown, not a text field: click it, use its filter input when needed, and select the plain unquoted attribute option (never the quoted constant). Click **Save**, then wait for the editor to close and verify the exact name/value row in **Additional claims** before adding the next claim. During the close transition the old form may briefly mark every field invalid even though the save succeeded; the refreshed claims row or `Successfully saved SSO user claims` notification is authoritative. Leave **Claim conditions** and **Advanced SAML claims options** untouched. Finish by verifying all four rows plus the existing `groups → user.groups` row in one claims-table read.
97
-
98
- 4. After all owners and claims are verified, close the Entra browser session and report Part B complete.
1
+ # Entra ID Setup
2
+
3
+ Ask the user only through the **AskUserQuestion** pop-up, never as chat text
4
+ waiting for a typed reply, and never with a single `Continue`-style option —
5
+ that is a wait, not a question. Ask only when there is a real choice, always
6
+ with at least two concrete options; enable free text only for open-ended
7
+ values (client ID, user count), not for yes/no decisions.
8
+
9
+ To wait for something the user does in the browser — signing in, filling a
10
+ field, clicking Submit — poll in a tool loop: wait ~5 s, re-read the page,
11
+ repeat until the expected state appears or ~5 minutes pass, then carry
12
+ straight on. Never end your turn while waiting; announcing "I'll continue
13
+ once you have signed in" and stopping ends the session, and nothing resumes
14
+ it. A page that renders blank is usually still loading or still on the
15
+ sign-in gate — keep polling instead of reporting it as a problem.
16
+
17
+ ---
18
+
19
+ Ask via **AskUserQuestion** once, before anything else: **"What do you need for the Entra ID application?"** — options `Request a new application` / `Configure an existing application`. Run only the matching part and never ask this again: `Request a new application` → **Part A**; `Configure an existing application` → **Part B**.
20
+
21
+ ---
22
+
23
+ ## Part A — Application Creation
24
+
25
+ Open `https://itsr.wistron.com/homepage/apply` in the browser and perform the request with the user:
26
+
27
+ 1. Click **Select Service Type**. The dialog holds hundreds of radios — never read the full snapshot. Type `Azure AD - Application Management` into its search box, click the matching `Add or Modify` radio, then click the **Submit** at the bottom of the dialog (the page's own Submit stays disabled until later).
28
+ 2. Select Add Application → Add Applicant.
29
+ 3. Fill in the required application details:
30
+ - Set the English application name from the chat context. Do not ask the user for it. If it is absent from the context, read the `name` property in `package.json` and convert it to spaced Pascal Case. Every name carries a company prefix in UPPERCASE: if the name already starts with `SMS` (any casing), uppercase that prefix and keep it — `sms-my-project` becomes `SMS My Project`. Otherwise prefix it with `WCZ` — `my-project` becomes `WCZ My Project`.
31
+ - Write a concise, single-sentence reason for creating the application based on its name and purpose. Do not ask the user for this.
32
+ - Ask via **AskUserQuestion** for the expected user count, and separately: **"Who can reach the app?"** — options `Internal network only (OA)` / `Also from the public internet`. Do not choose either value on their behalf. In the ITSR form, `Internal network only` is the OA-restricted choice.
33
+ - Application Manager: never ask. Take the signed-in user's name from the page header (top-right), type it into the **Application Manager** field, click its search button, and verify the resolved `<employee-id> (<dept><name>)` line appears under the field.
34
+ 4. Once every field is filled, click Submit yourself to add the applicant. The applicant appears in the page's summary table and enables the page-level final Submit.
35
+ 5. On the summary page, ask via **AskUserQuestion**: **"Submit the ITSR request?"** — options `Submit` / `Add another application`.
36
+ - `Add another application` → click **+ Add Applicant** above the summary table, fill the dialog exactly as in step 3, submit the dialog so the new row joins the table, then return to this question. Ask again for the new application's name, its expected user count, and its access scope — these are unique per application, so never carry them over from an existing row. Write its reason yourself.
37
+ - `Submit` → click the page-level final Submit and confirm the portal accepted the request.
38
+
39
+ Repeat until the user answers `Submit`. Only that answer may trigger the final Submit — the request goes to approvers.
40
+
41
+ When the portal needs sign-in, poll until the ITSR request form is visible and continue — do not end the turn.
42
+
43
+ Once the request is submitted, close the ITSR browser session and continue to the next step — the applications do not exist until the request is approved, so Part B cannot run yet.
44
+
45
+ ---
46
+
47
+ ## Part B — Application Configuration
48
+
49
+ Open `https://entra.microsoft.com/` and complete every Part B step in one uninterrupted run. Reuse this signed-in tab and the portal's own navigation; for slow controls, poll and re-read the current blade instead of reloading or opening another tab. Deep-linking a blade by URL hash is unreliable — some bounce back to **Overview** — so click the left-nav item instead. Derive every value from the app name and the fixed values below. Do not ask for owners; the owner list is fixed. Ask only before an explicitly user-approved irreversible action.
50
+
51
+ Gradually write all the data to `.env.local` with exactly these keys — keep any values already set by earlier steps (if this file does not exist, create it). If empty - fill `SESSION_SECRET` with a freshly generated value, and leave the rest empty until you know the values:
52
+
53
+ ```dotenv
54
+ ENTRA_CLIENT_ID=
55
+ ENTRA_TENANT_ID=
56
+ ENTRA_CLIENT_SECRET=
57
+ SESSION_SECRET=<generated-64-char-hex>
58
+ ```
59
+
60
+ **Left navigation: App Registrations:**
61
+
62
+ 1. Use the application's display name already present in chat context. Ask via **AskUserQuestion** only if it is genuinely absent; otherwise open **App registrations**, filter by the exact name, and click the matching row. Its **Overview** page shows **Application (client) ID** and **Directory (tenant) ID** — read both and write them to `.env.local` as `ENTRA_CLIENT_ID` and `ENTRA_TENANT_ID` straight away, before configuring anything else. Never ask the user for these two values. Leave `ENTRA_CLIENT_SECRET` empty only until the client secret is created in step 3.
63
+ 2. **Authentication (Preview)** — the left-nav item is named that, and it opens on the **Redirect URI configuration** tab. Three URIs are needed, where `<app-name>` is the app's display name in kebab-case — usually identical to the `name` in `package.json`:
64
+ - `http://localhost:3000/auth/callback`
65
+ - `https://<app-name>.wcz-sat-qas-01.k8s.wistron.com/auth/callback`
66
+ - `https://<app-name>.wcz-sat-prd-01.k8s.wistron.com/auth/callback`
67
+
68
+ The portal only accepts them one panel at a time:
69
+
70
+ a. **+ Add Redirect URI** → platform picker → **Web** → **Select**. The login flow is server-side (confidential client), so never pick **Single-page application**.
71
+ b. The panel takes a single URI. Enter the localhost one and click **Configure**. A success toast appears and the platform picker reopens — click **Cancel** to return to the list.
72
+ c. The list now shows a **Web** group row with an **Edit** link. Click **Edit**: the panel lists the saved URIs plus one empty row, and filling a row spawns another empty row below it. Add the `qas` and `prd` URIs, then click **Configure**.
73
+ d. Verify all three appear as Web rows in the list.
74
+
75
+ 3. **Certificates & secrets:** open the **Client secrets** tab → **+ New client secret**. Leave **Description** empty and set **Expires** to `730 days (24 months)` — always these values, never ask the user — then click **Add**. **CRITICAL — one chance only:** the new row's **Value** column holds the secret and is shown _only_ immediately after creation; once you leave or reload the blade it is masked forever and the app must get a brand-new secret. Read that **Value** from the row's textbox in the page snapshot, and write it into `ENTRA_CLIENT_SECRET` in `.env.local` as your very next action, before any other click or navigation. The neighbouring **Secret ID** column is a plain GUID and is _not_ the secret — writing it there is a silent, unrecoverable mistake. The cell renders truncated with `…`, so take the textbox's full value from the snapshot, and never print it in chat or a commit.
76
+ 4. **Token configuration:** click **Add groups claim**. In the panel tick **Security groups** only, then expand each of **ID**, **Access**, and **SAML** in "Customize token properties by type" and switch the radio from `Group ID` to `sAMAccountName`. Click **Add**. The list should then show a `groups` claim with token type `ID, Access, SAML`.
77
+ 5. **Expose an API:** next to **Application ID URI** click **Add** (or **Edit** if one exists). The portal prefills `api://<client-id>` — replace it with `api://wistron.com/<app-name>` (for `wh-fg-preparation`: `api://wistron.com/wh-fg-preparation`) and **Save**. Then **+ Add a scope** named `access_as_user`, set **Who can consent?** to `Admins and users`, and fill only the two required fields — **Admin consent display name** and **Admin consent description**. Leave the user consent fields empty (optional) and **State** on `Enabled`, then click **Add scope**. Do not navigate away or report progress as complete until the saved `api://wistron.com/<app-name>` URI and enabled `access_as_user` scope are both visible in the portal. Then set the `api` key in `src/lib/auth/scopes.ts` to the plain string `"api://wistron.com/<app-name>/access_as_user"` (`Scope` is `string | Partial<Record<ProviderId, string>>` — an array fails `satisfies Scopes`), matching the scope exactly as the portal lists it; leave the other keys untouched.
78
+ 6. **Owners:** first read the current table once. Add only missing people from this fixed list: Radim Staworowski, Martin Husar, Dalibor Homola, Patrik Lorenc, Tien Thanh Tran, Sebastian Ondruska. In the picker, search each missing full name, wait for the exact name and Wistron UPN match, select it, then replace the search text with the next name without closing the picker. Submit the batch once and verify all six names in the refreshed table.
79
+ 7. **Manifest:** the page opens the **Microsoft Graph App Manifest (New)** JSON in a Monaco editor. Do not retype the JSON — click into the editor, press `Ctrl+H`, and run Replace All twice: `"acceptMappedClaims": null` → `"acceptMappedClaims": true`, then `"requestedAccessTokenVersion": null` → `"requestedAccessTokenVersion": 2` (both live in the `api` object, one match each). Verify both edited lines, then click **Save**.
80
+
81
+ **Left navigation: Enterprise Applications:**
82
+
83
+ 1. Open **Enterprise apps → All applications** and search with the exact display name already resolved in App Registrations; do not ask for it again.
84
+ 2. **Owners:** repeat the batched owner process from App Registrations. Inspect the table once, keep the picker open while searching and selecting every missing exact Wistron record, and confirm the selected-user count increments after each selection. Click **Select** once, wait for `Owner assignment succeeded`, then verify all six names in the refreshed table. The toolbar and table may load after the heading; keep polling until both appear.
85
+ 3. **Single sign-on** opens as **OIDC-based Sign-on**; there is no SAML wizard. Wait for the embedded OIDC content, then click the visible **Edit** pencil under **② Attributes & Claims**. If its reference is stale, re-read this page and click the new reference. Ignore background `400`/`403` console messages while the requested controls remain usable. Confirm the claims list already holds `groups → user.groups`, then add each missing row with **+ Add new claim**:
86
+
87
+ | Claim Name | Source Attribute |
88
+ | ------------------ | --------------------------- |
89
+ | `department` | `user.department` |
90
+ | `employeeId` | `user.extensionattribute5` |
91
+ | `employeeCategory` | `user.extensionattribute13` |
92
+ | `companyName` | `user.companyname` |
93
+
94
+ For each one: type the claim name in **Name** and leave **Source** on `Attribute`. **Source attribute** is a dropdown, not a text field: click it, use its filter input when needed, and select the plain unquoted attribute option (never the quoted constant). Click **Save**, then wait for the editor to close and verify the exact name/value row in **Additional claims** before adding the next claim. The claims table can lag a save by several reads — keep re-reading, and reload the blade once if the new row still has not appeared. During the close transition the old form may briefly mark every field invalid even though the save succeeded; the refreshed claims row or `Successfully saved SSO user claims` notification is authoritative. Leave **Claim conditions** and **Advanced SAML claims options** untouched. Finish by verifying all four rows plus the existing `groups → user.groups` row in one claims-table read.
95
+
96
+ 4. After all owners and claims are verified, close the Entra browser session and report Part B complete.