@seliseblocks/cli-os 0.2.1 → 0.2.3

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 (38) hide show
  1. package/AI_USAGE_GUIDE.md +551 -546
  2. package/LICENSE +21 -21
  3. package/README.md +171 -171
  4. package/bin/run.js +2 -2
  5. package/dist/commands/data/files/delete.js +5 -4
  6. package/dist/commands/data/files/get-many.js +1 -1
  7. package/dist/commands/data/files/get.js +1 -1
  8. package/dist/commands/data/files/info.js +1 -1
  9. package/dist/commands/data/files/object-tree.d.ts +23 -0
  10. package/dist/commands/data/files/object-tree.js +238 -0
  11. package/dist/commands/data/files/presigned-upload-url.js +9 -2
  12. package/dist/commands/data/files/update-additional-info.js +2 -2
  13. package/dist/commands/data/files/upload-to-local-storage.js +2 -2
  14. package/dist/commands/data/files/upload.d.ts +2 -4
  15. package/dist/commands/data/files/upload.js +14 -28
  16. package/dist/index.js +685 -647
  17. package/dist/lib/scaffold-web/root-files.js +158 -0
  18. package/dist/skills/blocks-data-gateway-configuration/SKILL.md +204 -204
  19. package/dist/skills/blocks-data-gateway-crud/SKILL.md +223 -223
  20. package/dist/skills/blocks-data-storage/SKILL.md +253 -161
  21. package/dist/skills/blocks-data-storage/flows/object-management.md +124 -0
  22. package/dist/skills/blocks-frontend-local-https/SKILL.md +100 -100
  23. package/dist/skills/blocks-iam-account/SKILL.md +169 -169
  24. package/dist/skills/blocks-iam-sso-oidc-implementation/SKILL.md +80 -80
  25. package/dist/skills/blocks-iam-users/SKILL.md +131 -131
  26. package/dist/skills/blocks-localization-configuration/SKILL.md +149 -149
  27. package/dist/skills/blocks-localization-implementation/SKILL.md +63 -63
  28. package/dist/skills/blocks-onboarding/SKILL.md +77 -77
  29. package/dist/skills/blocks-storage-configuration/SKILL.md +4 -4
  30. package/package.json +47 -47
  31. package/dist/commands/data/files/create-folder.d.ts +0 -1
  32. package/dist/commands/data/files/create-folder.js +0 -34
  33. package/dist/commands/data/files/delete-folder.d.ts +0 -1
  34. package/dist/commands/data/files/delete-folder.js +0 -25
  35. package/dist/commands/data/files/dms-list.d.ts +0 -1
  36. package/dist/commands/data/files/dms-list.js +0 -27
  37. package/dist/commands/data/files/dms-upload.d.ts +0 -6
  38. package/dist/commands/data/files/dms-upload.js +0 -41
@@ -1,78 +1,78 @@
1
- ---
2
- name: blocks-onboarding
3
- description: "Onboard a user into SELISE Blocks before any other Blocks skill can run, using the `blocks` CLI — never raw API calls. Detects current state (CLI installed?, logged in?, project selected?) via `blocks auth status --json`/`doctor --json` and closes each gap: install, `login` (device-code, no setup needed), list/select a project (`projects create` is currently disabled — new projects come from the portal), `blocks init`, then resolve/create the app's OIDC client via `auth oidc-clients` (no portal needed) before handing off to `blocks new web`. Use when a user is new to Blocks, asks how to get started, or hits `not_logged_in`/`project_not_selected` from another command."
4
- ---
5
-
6
- # Blocks — Onboarding
7
-
8
- Every other Blocks skill assumes: the `blocks` CLI is installed, the user is logged in (`login`), and a project is selected (`use`). This skill detects which of those is missing and closes the gap. **Everything here goes through `blocks` — never a raw `fetch`/`curl` against `api.seliseblocks.com`.**
9
-
10
- The CLI's own usage guide (bundled with the `blocks-cli` package) is the command-level ground truth (exact flags, defaults, failure codes); this skill is the conversational flow around it — what to ask, what's portal-only, and in what order.
11
-
12
- ## Probe first, ask second
13
-
14
- Run `blocks auth status --json` and branch on the result — don't interrogate the user about state that's discoverable:
15
-
16
- | Signal | State | Do this |
17
- |---|---|---|
18
- | command not found | CLI not installed | `npm install -g @seliseblocks/cli-os`, then re-probe |
19
- | `accountAccessToken`/`accountRefreshToken` both `"missing"` | Never logged in | Step 1 — `login` |
20
- | logged in, no project selected (check `blocks doctor --json`'s "Project selected" check) | No project selected | Step 2 — list/`use` |
21
- | logged in, project selected | Ready | Confirm the project with the user — always show the full accessible-project list and which one is currently selected, never silently continue on a prior session's selection — then hand off to the skill/task that brought you here |
22
-
23
- If anything looks broken rather than simply "not yet done" (unreadable/stale local token storage after a machine migration, Windows profile change, Keychain reset), run `blocks doctor --json` for the fuller diagnostic — it checks Node version, config/token/secret file locations, and token freshness in one pass. If storage itself is unreadable or corrupted, `blocks auth remove <account>` clears cached tokens and stored local credentials (restoring the packaged default account), then re-run `login`.
24
-
25
- ## Step 1 — Log in
26
-
27
- The CLI authenticates itself with no setup. There is no OIDC client to register in the portal for this, no client id/secret to collect from the user, and nothing about how the CLI does it to look up, print, or report — just log in:
28
-
29
- ```bash
30
- blocks login
31
- ```
32
-
33
- Device-code flow: it prints a verification URL and user code, opens the browser to the verification page when possible so the user only needs to click approve, then polls until the device is authorized; stores account access and refresh tokens and auto-refreshes later. Run it yourself rather than only telling the user to run it, so you can read the printed code/URL and confirm the result right after.
34
-
35
- Verify with `blocks auth status --json` — re-run after login rather than assuming it worked.
36
-
37
- ## Step 2 — Project
38
-
39
- Ask **what the user wants to build** and whether they already have a project, rather than assuming:
40
-
41
- ```bash
42
- blocks projects list --json
43
- ```
44
-
45
- Always show the full list of accessible projects, and if one already appears selected, say which one — never silently continue on a prior session's selection. If projects exist, confirm which one (and which environment) the user wants; never guess.
46
-
47
- **`projects create` is currently disabled in this CLI build** (commented out pending a product decision — there is no CLI path to create a new project). If none of the listed projects fit, tell the user a new project must be created from the Blocks portal first; once they confirm it exists, re-run `blocks projects list --json` and continue from here.
48
-
49
- Then select it:
50
-
51
- ```bash
52
- blocks use <x-blocks-key>
53
- ```
54
-
55
- Project (impersonation) tokens are created lazily from the account session the first time a project-scoped command needs one — never ask the user for a project token directly. If an impersonated project token later gets stuck, rejected, or expired and `blocks auth refresh --project --json` doesn't fix it, recover with:
56
-
57
- ```bash
58
- blocks deselect # drops the selection and its cached impersonation token
59
- blocks use <x-blocks-key> # reselect the same x-blocks-key to force a fresh impersonation
60
- ```
61
-
62
- ## Step 3 — Local workspace + hand off
63
-
64
- Run `blocks init` once per project directory to create `blocks.json`, `blocks/data/schemas/`, `blocks/data/rules.json`, and `.env.example` — the later data-gateway skills read/write these. Safe to re-run: it never overwrites files that already exist. (`init` does not create a localization folder or any release-related file — `blocks/localization/` only appears later, lazily, the first time `blocks localization pull` writes to it, and there is no `blocks/release/*` file at all.)
65
-
66
- Then route to what the user actually wants:
67
- - Building a frontend from scratch → resolve the app's public OIDC client first, then scaffold:
68
- - `blocks auth oidc-clients list --json` — check whether a client already registered for this project fits. If none fits, create one directly (no portal visit needed): `blocks auth oidc-clients save --client-display-name <appName> --redirect-uris https://<domain>:5173/login/callback --scope "openid profile" --require-pkce --register-as-identity-provider --dry-run --json`, then re-run with `--yes` after showing the dry-run output and getting approval. See the blocks-iam-sso-oidc-configuration skill for the full decision tree and field-level gotchas.
1
+ ---
2
+ name: blocks-onboarding
3
+ description: "Onboard a user into SELISE Blocks before any other Blocks skill can run, using the `blocks` CLI — never raw API calls. Detects current state (CLI installed?, logged in?, project selected?) via `blocks auth status --json`/`doctor --json` and closes each gap: install, `login` (device-code, no setup needed), list/select a project (`projects create` is currently disabled — new projects come from the portal), `blocks init`, then resolve/create the app's OIDC client via `auth oidc-clients` (no portal needed) before handing off to `blocks new web`. Use when a user is new to Blocks, asks how to get started, or hits `not_logged_in`/`project_not_selected` from another command."
4
+ ---
5
+
6
+ # Blocks — Onboarding
7
+
8
+ Every other Blocks skill assumes: the `blocks` CLI is installed, the user is logged in (`login`), and a project is selected (`use`). This skill detects which of those is missing and closes the gap. **Everything here goes through `blocks` — never a raw `fetch`/`curl` against `api.seliseblocks.com`.**
9
+
10
+ The CLI's own usage guide (bundled with the `blocks-cli` package) is the command-level ground truth (exact flags, defaults, failure codes); this skill is the conversational flow around it — what to ask, what's portal-only, and in what order.
11
+
12
+ ## Probe first, ask second
13
+
14
+ Run `blocks auth status --json` and branch on the result — don't interrogate the user about state that's discoverable:
15
+
16
+ | Signal | State | Do this |
17
+ |---|---|---|
18
+ | command not found | CLI not installed | `npm install -g @seliseblocks/cli-os`, then re-probe |
19
+ | `accountAccessToken`/`accountRefreshToken` both `"missing"` | Never logged in | Step 1 — `login` |
20
+ | logged in, no project selected (check `blocks doctor --json`'s "Project selected" check) | No project selected | Step 2 — list/`use` |
21
+ | logged in, project selected | Ready | Confirm the project with the user — always show the full accessible-project list and which one is currently selected, never silently continue on a prior session's selection — then hand off to the skill/task that brought you here |
22
+
23
+ If anything looks broken rather than simply "not yet done" (unreadable/stale local token storage after a machine migration, Windows profile change, Keychain reset), run `blocks doctor --json` for the fuller diagnostic — it checks Node version, config/token/secret file locations, and token freshness in one pass. If storage itself is unreadable or corrupted, `blocks auth remove <account>` clears cached tokens and stored local credentials (restoring the packaged default account), then re-run `login`.
24
+
25
+ ## Step 1 — Log in
26
+
27
+ The CLI authenticates itself with no setup. There is no OIDC client to register in the portal for this, no client id/secret to collect from the user, and nothing about how the CLI does it to look up, print, or report — just log in:
28
+
29
+ ```bash
30
+ blocks login
31
+ ```
32
+
33
+ Device-code flow: it prints a verification URL and user code, opens the browser to the verification page when possible so the user only needs to click approve, then polls until the device is authorized; stores account access and refresh tokens and auto-refreshes later. Run it yourself rather than only telling the user to run it, so you can read the printed code/URL and confirm the result right after.
34
+
35
+ Verify with `blocks auth status --json` — re-run after login rather than assuming it worked.
36
+
37
+ ## Step 2 — Project
38
+
39
+ Ask **what the user wants to build** and whether they already have a project, rather than assuming:
40
+
41
+ ```bash
42
+ blocks projects list --json
43
+ ```
44
+
45
+ Always show the full list of accessible projects, and if one already appears selected, say which one — never silently continue on a prior session's selection. If projects exist, confirm which one (and which environment) the user wants; never guess.
46
+
47
+ **`projects create` is currently disabled in this CLI build** (commented out pending a product decision — there is no CLI path to create a new project). If none of the listed projects fit, tell the user a new project must be created from the Blocks portal first; once they confirm it exists, re-run `blocks projects list --json` and continue from here.
48
+
49
+ Then select it:
50
+
51
+ ```bash
52
+ blocks use <x-blocks-key>
53
+ ```
54
+
55
+ Project (impersonation) tokens are created lazily from the account session the first time a project-scoped command needs one — never ask the user for a project token directly. If an impersonated project token later gets stuck, rejected, or expired and `blocks auth refresh --project --json` doesn't fix it, recover with:
56
+
57
+ ```bash
58
+ blocks deselect # drops the selection and its cached impersonation token
59
+ blocks use <x-blocks-key> # reselect the same x-blocks-key to force a fresh impersonation
60
+ ```
61
+
62
+ ## Step 3 — Local workspace + hand off
63
+
64
+ Run `blocks init` once per project directory to create `blocks.json`, `blocks/data/schemas/`, `blocks/data/rules.json`, and `.env.example` — the later data-gateway skills read/write these. Safe to re-run: it never overwrites files that already exist. (`init` does not create a localization folder or any release-related file — `blocks/localization/` only appears later, lazily, the first time `blocks localization pull` writes to it, and there is no `blocks/release/*` file at all.)
65
+
66
+ Then route to what the user actually wants:
67
+ - Building a frontend from scratch → resolve the app's public OIDC client first, then scaffold:
68
+ - `blocks auth oidc-clients list --json` — check whether a client already registered for this project fits. If none fits, create one directly (no portal visit needed): `blocks auth oidc-clients save --client-display-name <appName> --redirect-uris https://<domain>:5173/login/callback --scope "openid profile" --require-pkce --register-as-identity-provider --dry-run --json`, then re-run with `--yes` after showing the dry-run output and getting approval. See the blocks-iam-sso-oidc-configuration skill for the full decision tree and field-level gotchas.
69
69
  - `blocks new web <name> --x-blocks-key <tenantId> --app-domain <domain> --client-id <the-resolved-client-id>`. **Always pass `--client-id` and `--app-domain` explicitly** — omitting either drops `new web` into an interactive pick-list prompt with no non-interactive escape (not even to "skip"), which hangs a scripted/agent run with no stdin to answer it. Omit `--blocks-api-url` unless the project uses a non-default gateway; the scaffold derives it from the app domain, e.g. `https://dqrsf.slsblx.com` -> `https://blocksapi.slsblx.com`.
70
- - Defining data / CRUD / localization / release on an existing project → hand off to the matching skill; the project is already selected via `blocks use`, so its commands can proceed directly.
71
-
72
- ## Gotchas
73
-
74
- - **Only one OIDC client matters here, and it's not the CLI's.** The CLI authenticates itself with no setup — nothing to register, nothing portal-only about `blocks login` itself, and nothing about how it does so to look up or mention. The only OIDC client involved is the scaffolded app's *public* browser client for its own end-user login (Step 3) — and that no longer requires the portal either: `blocks auth oidc-clients list`/`save` resolve or create it entirely through the CLI on the project's impersonated token. The portal remains available if the user prefers it, but it's an alternative, not a requirement. Don't tell a user they need to register anything before `blocks login` will work, and don't send them to the portal for the app's OIDC client by default.
75
- - **`blocks new web` hangs a non-interactive run if `--client-id` or `--app-domain` is omitted** — it drops into an interactive pick-list (even to offer "skip") with no stdin to answer it in an agent-driven session. Always resolve both explicitly first (Step 3) rather than omitting either and hoping for a graceful default.
76
- - **Never open, read, print, or expose the CLI's local storage files** (its config/token/secret files on disk) or anything inside them — client ids, root tenant id, account names, tokens. Only ever interact with them through `blocks` commands, never by inspecting the files directly. `auth status`/`doctor` only ever report token state (`missing`/`valid`/`expired`), never the value.
77
- - **Known CLI error codes and fixes** (from the CLI's own error handling): `not_logged_in` → `blocks login`; `refresh_token_rejected` → `blocks login`; unreadable/stale local auth storage → `blocks auth remove <account>` then `blocks login`; `project_not_selected` → `blocks use <x-blocks-key>` (or pass `--project <tenantId>` for a single one-off command); `api_auth_failed` → `blocks auth status --json` then log in again; `impersonation_invalid_client` → not a stale-token problem, the account's OIDC client isn't registered for impersonation — check `blocks auth config get` and have an admin register it, `login`/`deselect`+`use` won't fix this one.
78
- - **`--dry-run` before `--yes`** on every mutating command (`auth oidc-clients save`, `data schema push`/`data rules deploy`, `localization push`, `release deploy`) — this recurs in every skill that mutates project state.
70
+ - Defining data / CRUD / localization / release on an existing project → hand off to the matching skill; the project is already selected via `blocks use`, so its commands can proceed directly.
71
+
72
+ ## Gotchas
73
+
74
+ - **Only one OIDC client matters here, and it's not the CLI's.** The CLI authenticates itself with no setup — nothing to register, nothing portal-only about `blocks login` itself, and nothing about how it does so to look up or mention. The only OIDC client involved is the scaffolded app's *public* browser client for its own end-user login (Step 3) — and that no longer requires the portal either: `blocks auth oidc-clients list`/`save` resolve or create it entirely through the CLI on the project's impersonated token. The portal remains available if the user prefers it, but it's an alternative, not a requirement. Don't tell a user they need to register anything before `blocks login` will work, and don't send them to the portal for the app's OIDC client by default.
75
+ - **`blocks new web` hangs a non-interactive run if `--client-id` or `--app-domain` is omitted** — it drops into an interactive pick-list (even to offer "skip") with no stdin to answer it in an agent-driven session. Always resolve both explicitly first (Step 3) rather than omitting either and hoping for a graceful default.
76
+ - **Never open, read, print, or expose the CLI's local storage files** (its config/token/secret files on disk) or anything inside them — client ids, root tenant id, account names, tokens. Only ever interact with them through `blocks` commands, never by inspecting the files directly. `auth status`/`doctor` only ever report token state (`missing`/`valid`/`expired`), never the value.
77
+ - **Known CLI error codes and fixes** (from the CLI's own error handling): `not_logged_in` → `blocks login`; `refresh_token_rejected` → `blocks login`; unreadable/stale local auth storage → `blocks auth remove <account>` then `blocks login`; `project_not_selected` → `blocks use <x-blocks-key>` (or pass `--project <tenantId>` for a single one-off command); `api_auth_failed` → `blocks auth status --json` then log in again; `impersonation_invalid_client` → not a stale-token problem, the account's OIDC client isn't registered for impersonation — check `blocks auth config get` and have an admin register it, `login`/`deselect`+`use` won't fix this one.
78
+ - **`--dry-run` before `--yes`** on every mutating command (`auth oidc-clients save`, `data schema push`/`data rules deploy`, `localization push`, `release deploy`) — this recurs in every skill that mutates project state.
@@ -1,13 +1,13 @@
1
1
  ---
2
2
  name: blocks-storage-configuration
3
- description: "Configure which storage provider (Azure Blob, S3, or local disk) backs a SELISE Blocks project's files: named configurations with host, port, credentials, region/endpoint or connection string, and strategy, via the blocks CLI ('storage config get/list/save/delete'), project-scoped with an impersonated project token. CLI-only admin surface, no SDK equivalent. Use for set up a storage provider, list/inspect storage configs, rotate storage credentials, switch to local storage, delete a config. Uploading/downloading files once configured is blocks-data-storage's job."
3
+ description: "Configure which storage provider (Azure Blob, S3-compatible object storage, or local/SFTP storage) backs a SELISE Blocks project's file object tree: named configurations with host, port, credentials, region/endpoint or connection string, and strategy, via the blocks CLI ('storage config get/list/save/delete'). CLI-only, project-scoped admin surface. Use to create, inspect, rotate, switch, or delete provider configurations; file/directory/object operations belong to blocks-data-storage."
4
4
  ---
5
5
 
6
6
  # Blocks Storage — Configuration
7
7
 
8
- This skill manages the **storage configuration record itself** — which cloud provider (or local disk) a named configuration points at, and the connection details needed to reach it. It does not upload, download, or browse files; that's a separate, project-scoped runtime concern handled by the sibling blocks-data-storage skill (`blocks data files *` CLI, or the SDK's `data.files`/`data.dms` at runtime).
8
+ This skill manages the **storage configuration record itself** — which cloud provider (or local/SFTP storage) a named configuration points at, and the connection details needed to reach it. It does not upload, download, browse, share, version, move, or trash objects; those runtime concerns belong to blocks-data-storage.
9
9
 
10
- **CLI-only, no SDK path.** There is no `@seliseblocks/client` method for reading or writing a storage configuration's own fields the SDK's role in this area starts *after* a configuration exists (it takes a `configurationName` and uploads/downloads against whatever that config points at). If a user wants to set up, inspect, or change a storage provider, that's this skill's `blocks storage config *` commands; if they want to move bytes, hand off to blocks-data-storage.
10
+ **CLI-only, no SDK path.** There is no `@seliseblocks/client` method for reading or writing a storage configuration's own fields. Runtime storage calls select an existing record by `configurationName`. If the user wants to manipulate a file/directory or its access policies, hand off to blocks-data-storage.
11
11
 
12
12
  **Prerequisite:** a project is selected (`blocks use <tenantId>`). If login/project state is unknown, run the blocks-onboarding skill first.
13
13
 
@@ -78,7 +78,7 @@ blocks storage config delete Default --yes --json
78
78
 
79
79
  - **`get`/`list` are not redacted.** Only `save --dry-run`'s own preview output redacts `accessKey`/`connectionString`/`password`/`secretKey`. If a `get`/`list` response ever echoes credential fields back, treat that output as sensitive — don't paste it into logs, tickets, or chat verbatim.
80
80
  - **`save` is upsert, not separate create/update commands.** Whether a call creates or updates is determined by whether `--item-id` is present, not by a different command name.
81
- - **This is provider configuration, not file operations.** `blocks storage config *` never touches an actual file's bytes. For "upload a file," "get a download link," "list a folder" that's **blocks-data-storage** (`blocks data files *` or the SDK), using a `configurationName` that a `storage config` record already defines.
81
+ - **This is provider configuration, not object management.** `blocks storage config *` never touches file bytes, directory hierarchy, versions, trash, sharing, or ACLs. Those belong to **blocks-data-storage**, using a `configurationName` that a storage config already defines.
82
82
  - **No positional-or-flag ambiguity trap:** `get`/`delete` accept the configuration name as either the first positional argument or `--name`; only one is required, not both.
83
83
  - **Impersonated project token only.** Like `secrets *` and `data config *`, none of these four commands run against the account token — a project must be selected first (`blocks use <tenantId>`).
84
84
 
package/package.json CHANGED
@@ -1,47 +1,47 @@
1
- {
2
- "name": "@seliseblocks/cli-os",
3
- "version": "0.2.1",
4
- "description": "CLI for SELISE Blocks project setup and configuration.",
5
- "license": "MIT",
6
- "type": "module",
7
- "bin": {
8
- "blocks": "bin/run.js"
9
- },
10
- "main": "./dist/index.js",
11
- "types": "./dist/index.d.ts",
12
- "exports": {
13
- ".": {
14
- "types": "./dist/index.d.ts",
15
- "import": "./dist/index.js"
16
- },
17
- "./package.json": "./package.json"
18
- },
19
- "publishConfig": {
20
- "access": "public"
21
- },
22
- "sideEffects": false,
23
- "files": [
24
- "bin",
25
- "dist",
26
- "README.md",
27
- "AI_USAGE_GUIDE.md",
28
- "LICENSE"
29
- ],
30
- "scripts": {
31
- "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
32
- "build": "npm run clean && tsc -p tsconfig.json && node scripts/copy-skills.mjs",
33
- "dev": "tsx src/index.ts",
34
- "lint": "tsc -p tsconfig.json --noEmit",
35
- "test": "npm run build && node --test test/*.test.mjs",
36
- "prepack": "npm run build",
37
- "prepublishOnly": "npm test"
38
- },
39
- "devDependencies": {
40
- "@types/node": "^22.0.0",
41
- "tsx": "^4.16.0",
42
- "typescript": "^5.5.0"
43
- },
44
- "engines": {
45
- "node": ">=20"
46
- }
47
- }
1
+ {
2
+ "name": "@seliseblocks/cli-os",
3
+ "version": "0.2.3",
4
+ "description": "CLI for SELISE Blocks project setup and configuration.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "blocks": "bin/run.js"
9
+ },
10
+ "main": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "exports": {
13
+ ".": {
14
+ "types": "./dist/index.d.ts",
15
+ "import": "./dist/index.js"
16
+ },
17
+ "./package.json": "./package.json"
18
+ },
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "sideEffects": false,
23
+ "files": [
24
+ "bin",
25
+ "dist",
26
+ "README.md",
27
+ "AI_USAGE_GUIDE.md",
28
+ "LICENSE"
29
+ ],
30
+ "scripts": {
31
+ "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
32
+ "build": "npm run clean && tsc -p tsconfig.json && node scripts/copy-skills.mjs",
33
+ "dev": "tsx src/index.ts",
34
+ "lint": "tsc -p tsconfig.json --noEmit",
35
+ "test": "npm run build && node --test test/*.test.mjs",
36
+ "prepack": "npm run build",
37
+ "prepublishOnly": "npm test"
38
+ },
39
+ "devDependencies": {
40
+ "@types/node": "^22.0.0",
41
+ "tsx": "^4.16.0",
42
+ "typescript": "^5.5.0"
43
+ },
44
+ "engines": {
45
+ "node": ">=20"
46
+ }
47
+ }
@@ -1 +0,0 @@
1
- export declare function dataFilesCreateFolder(argv: string[]): Promise<void>;
@@ -1,34 +0,0 @@
1
- import { booleanFlag, stringFlag } from "../../../lib/args.js";
2
- import { blocksRequest } from "../../../lib/api.js";
3
- import { confirmMutation } from "../../../lib/confirm.js";
4
- import { compact, jsonBodyFlag, listFlag } from "../../../lib/json-flag.js";
5
- import { writeOutput } from "../../../lib/output.js";
6
- import { requestContext } from "../../../lib/request-context.js";
7
- import { parseCommand, selectedProject } from "../../../lib/workspace.js";
8
- export async function dataFilesCreateFolder(argv) {
9
- const { args, flags } = parseCommand(argv);
10
- const artifactName = args[0] || stringFlag(flags, "name", { required: true });
11
- const body = {
12
- ...(await jsonBodyFlag(flags)),
13
- ...compact({
14
- artifactName,
15
- configurationName: stringFlag(flags, "configuration-name") || undefined,
16
- description: stringFlag(flags, "description") || undefined,
17
- parentId: stringFlag(flags, "parent-id"),
18
- tags: listFlag(flags, "tags")
19
- })
20
- };
21
- if (booleanFlag(flags, "dry-run")) {
22
- writeOutput({ dryRun: true, endpoint: "/data/v4/Files/CreateFolder", request: body }, flags);
23
- return;
24
- }
25
- await confirmMutation(flags, `Create DMS folder '${artifactName}'.`);
26
- const projectKey = await selectedProject(flags);
27
- const result = await blocksRequest("/data/v4/Files/CreateFolder", {
28
- body,
29
- impersonatedProjectAuth: true,
30
- ...requestContext(flags),
31
- projectTenantId: projectKey
32
- });
33
- writeOutput(result, flags);
34
- }
@@ -1 +0,0 @@
1
- export declare function dataFilesDeleteFolder(argv: string[]): Promise<void>;
@@ -1,25 +0,0 @@
1
- import { booleanFlag, stringFlag } from "../../../lib/args.js";
2
- import { blocksRequest } from "../../../lib/api.js";
3
- import { confirmMutation } from "../../../lib/confirm.js";
4
- import { compact } from "../../../lib/json-flag.js";
5
- import { writeOutput } from "../../../lib/output.js";
6
- import { requestContext } from "../../../lib/request-context.js";
7
- import { parseCommand, selectedProject } from "../../../lib/workspace.js";
8
- export async function dataFilesDeleteFolder(argv) {
9
- const { args, flags } = parseCommand(argv);
10
- const folderId = args[0] || stringFlag(flags, "folder-id", { required: true });
11
- const body = { folderId, ...compact({ configurationName: stringFlag(flags, "configuration-name") || undefined }) };
12
- if (booleanFlag(flags, "dry-run")) {
13
- writeOutput({ dryRun: true, endpoint: "/data/v4/Files/DeleteFolder", request: body }, flags);
14
- return;
15
- }
16
- await confirmMutation(flags, `Delete DMS folder '${folderId}'.`);
17
- const projectKey = await selectedProject(flags);
18
- const result = await blocksRequest("/data/v4/Files/DeleteFolder", {
19
- body,
20
- impersonatedProjectAuth: true,
21
- ...requestContext(flags),
22
- projectTenantId: projectKey
23
- });
24
- writeOutput(result, flags);
25
- }
@@ -1 +0,0 @@
1
- export declare function dataFilesDmsList(argv: string[]): Promise<void>;
@@ -1,27 +0,0 @@
1
- import { integerFlag, stringFlag } from "../../../lib/args.js";
2
- import { blocksRequest } from "../../../lib/api.js";
3
- import { compact } from "../../../lib/json-flag.js";
4
- import { writeOutput } from "../../../lib/output.js";
5
- import { requestContext } from "../../../lib/request-context.js";
6
- import { parseCommand, selectedProject } from "../../../lib/workspace.js";
7
- export async function dataFilesDmsList(argv) {
8
- const { flags } = parseCommand(argv);
9
- const body = {
10
- parentId: stringFlag(flags, "parent-id"),
11
- take: integerFlag(flags, "take", 20),
12
- ...compact({
13
- configurationName: stringFlag(flags, "configuration-name") || undefined,
14
- moduleName: stringFlag(flags, "module-name") || undefined,
15
- searchKey: stringFlag(flags, "search") || undefined,
16
- skip: integerFlag(flags, "skip", 0) || undefined
17
- })
18
- };
19
- const projectKey = await selectedProject(flags);
20
- const result = await blocksRequest("/data/v4/Files/GetDmsFileAndFolder", {
21
- body,
22
- impersonatedProjectAuth: true,
23
- ...requestContext(flags),
24
- projectTenantId: projectKey
25
- });
26
- writeOutput(result, flags);
27
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * Registers an already-uploaded file (via presigned-upload-url/upload-to-url or
3
- * upload-to-local-storage) so it shows up in a DMS folder. `--file-storage-id` covers the
4
- * common single-file case; pass --body/--file with an `upload` array to register several at once.
5
- */
6
- export declare function dataFilesDmsUpload(argv: string[]): Promise<void>;
@@ -1,41 +0,0 @@
1
- import { booleanFlag, stringFlag } from "../../../lib/args.js";
2
- import { blocksRequest } from "../../../lib/api.js";
3
- import { confirmMutation } from "../../../lib/confirm.js";
4
- import { compact, jsonBodyFlag, listFlag } from "../../../lib/json-flag.js";
5
- import { writeOutput } from "../../../lib/output.js";
6
- import { requestContext } from "../../../lib/request-context.js";
7
- import { parseCommand, selectedProject } from "../../../lib/workspace.js";
8
- /**
9
- * Registers an already-uploaded file (via presigned-upload-url/upload-to-url or
10
- * upload-to-local-storage) so it shows up in a DMS folder. `--file-storage-id` covers the
11
- * common single-file case; pass --body/--file with an `upload` array to register several at once.
12
- */
13
- export async function dataFilesDmsUpload(argv) {
14
- const { flags } = parseCommand(argv);
15
- const fileStorageId = stringFlag(flags, "file-storage-id");
16
- const body = await jsonBodyFlag(flags);
17
- if (fileStorageId) {
18
- body.upload = [compact({
19
- artifactName: stringFlag(flags, "artifact-name") || undefined,
20
- fileStorageId,
21
- parentId: stringFlag(flags, "parent-id"),
22
- tags: listFlag(flags, "tags")
23
- })];
24
- }
25
- if (!Array.isArray(body.upload) || !body.upload.length) {
26
- throw new Error("Provide --file-storage-id (with --artifact-name) or an 'upload' array via --body/--file.");
27
- }
28
- if (booleanFlag(flags, "dry-run")) {
29
- writeOutput({ dryRun: true, endpoint: "/data/v4/Files/UploadFile", request: body }, flags);
30
- return;
31
- }
32
- await confirmMutation(flags, `Register ${body.upload.length} file(s) into DMS.`);
33
- const projectKey = await selectedProject(flags);
34
- const result = await blocksRequest("/data/v4/Files/UploadFile", {
35
- body,
36
- impersonatedProjectAuth: true,
37
- ...requestContext(flags),
38
- projectTenantId: projectKey
39
- });
40
- writeOutput(result, flags);
41
- }