@b64hub/sfpm-cli 0.4.0 → 0.5.1

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 (34) hide show
  1. package/README.md +140 -70
  2. package/dist/commands/add.js +29 -2
  3. package/dist/commands/add.js.map +1 -1
  4. package/dist/commands/build/index.js +13 -11
  5. package/dist/commands/build/index.js.map +1 -1
  6. package/dist/commands/deploy/index.js +1 -1
  7. package/dist/commands/deploy/index.js.map +1 -1
  8. package/dist/commands/install.js +1 -1
  9. package/dist/commands/package/create.d.ts +3 -0
  10. package/dist/commands/package/create.js +68 -17
  11. package/dist/commands/package/create.js.map +1 -1
  12. package/dist/commands/pool/clean.d.ts +18 -0
  13. package/dist/commands/pool/clean.js +28 -0
  14. package/dist/commands/pool/clean.js.map +1 -0
  15. package/dist/commands/pool/delete.d.ts +1 -1
  16. package/dist/commands/pool/delete.js +12 -7
  17. package/dist/commands/pool/delete.js.map +1 -1
  18. package/dist/commands/pool/fetch.d.ts +0 -1
  19. package/dist/commands/pool/fetch.js +0 -2
  20. package/dist/commands/pool/fetch.js.map +1 -1
  21. package/dist/commands/project/index.js +1 -1
  22. package/dist/commands/project/index.js.map +1 -1
  23. package/dist/commands/project/init/turbo.js +2 -2
  24. package/dist/commands/project/init/turbo.js.map +1 -1
  25. package/dist/commands/project/sync.js +4 -2
  26. package/dist/commands/project/sync.js.map +1 -1
  27. package/dist/commands/publish.js +1 -1
  28. package/dist/commands/publish.js.map +1 -1
  29. package/dist/commands/skills.d.ts +23 -0
  30. package/dist/commands/skills.js +47 -0
  31. package/dist/commands/skills.js.map +1 -0
  32. package/oclif.manifest.json +467 -281
  33. package/package.json +13 -12
  34. package/skills/sfpm/SKILL.md +104 -0
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@b64hub/sfpm-cli",
3
3
  "description": "Salesforce package manager - CLI",
4
4
  "release": "Seedling",
5
- "version": "0.4.0",
5
+ "version": "0.5.1",
6
6
  "author": "b64",
7
7
  "bin": {
8
8
  "sfpm": "./bin/run.js"
@@ -10,32 +10,32 @@
10
10
  "bugs": "https://github.com/b64hub/sfpm/issues",
11
11
  "dependencies": {
12
12
  "@b64hub/sfpm-core": "^0.4.0",
13
- "@b64hub/sfpm-orgs": "^0.2.0",
13
+ "@b64hub/sfpm-orgs": "^0.3.0",
14
14
  "@b64hub/sfpm-sfdmu": "^0.2.0",
15
15
  "@b64hub/sfpm-validation": "0.2.0",
16
16
  "@b64hub/sfpm-telemetry": "^0.2.0",
17
17
  "@inkjs/ui": "^2.0.0",
18
- "@inquirer/prompts": "^8.3.2",
18
+ "@inquirer/prompts": "^8.7.5",
19
19
  "@oclif/core": "^4",
20
20
  "@oclif/plugin-help": "^6",
21
21
  "@oclif/plugin-plugins": "^5",
22
- "@oclif/table": "^0.5.1",
22
+ "@oclif/table": "^1.0.8",
23
23
  "@salesforce/core": "^8.31.0",
24
24
  "boxen": "^8.0.1",
25
25
  "chalk": "^5.6.2",
26
- "fs-extra": "^11.3.3",
26
+ "fs-extra": "^11.4.1",
27
27
  "gradient-string": "^3.0.0",
28
28
  "ink": "^7.1.1",
29
29
  "listr2": "^8.2.5",
30
30
  "node-notifier": "^10.0.1",
31
31
  "object-treeify": "^5.0.1",
32
32
  "ora": "^9.0.0",
33
- "pino": "^10.3.1",
34
- "pino-pretty": "^13.1.3",
35
- "react": "^19.2.8"
33
+ "pino": "^10.4.0",
34
+ "pino-pretty": "^13.2.0",
35
+ "react": "^19.3.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@oclif/test": "^4",
38
+ "@oclif/test": "^5",
39
39
  "@types/chai": "^4",
40
40
  "@types/fs-extra": "^11.0.4",
41
41
  "@types/gradient-string": "^1.1.6",
@@ -43,11 +43,11 @@
43
43
  "@types/node": "^18",
44
44
  "@types/node-notifier": "^8.0.5",
45
45
  "@types/pino-pretty": "^5.0.0",
46
- "@types/react": "^19.2.17",
46
+ "@types/react": "^19.3.0",
47
47
  "chai": "^4",
48
48
  "mocha": "^10",
49
- "oclif": "^4",
50
- "shx": "^0.3.3"
49
+ "oclif": "^6",
50
+ "shx": "^0.4.0"
51
51
  },
52
52
  "engines": {
53
53
  "node": ">=18.0.0"
@@ -56,6 +56,7 @@
56
56
  "./bin",
57
57
  "./dist",
58
58
  "./oclif.manifest.json",
59
+ "./skills",
59
60
  "./theme.json"
60
61
  ],
61
62
  "homepage": "https://github.com/b64hub/sfpm",
@@ -0,0 +1,104 @@
1
+ ---
2
+ name: sfpm
3
+ description: Build, deploy, install and release Salesforce packages with sfpm and Turborepo. Use when working in an sfpm/pnpm workspace, running sfpm or turbo sfpm:* tasks, creating packages, managing scratch org pools, or releasing.
4
+ ---
5
+
6
+ # sfpm
7
+
8
+ sfpm is a Salesforce package manager CLI. Packages are npm-style workspace packages
9
+ (pnpm workspaces), orchestrated across the repo by Turborepo. Use `sfpm <command> --help`
10
+ for the full flag list of any command; this skill covers workflows and rules, not flag tables.
11
+
12
+ ## Workspace model
13
+
14
+ - Packages live in pnpm workspace directories. Each package has a `package.json` with an
15
+ `sfpm` field (package type, etc.) and its own Salesforce source.
16
+ - `sfdx-project.json` is GENERATED and gitignored. Never hand-edit it. Regenerate it with
17
+ `sfpm project sync` after changing workspace packages or their `package.json` files.
18
+ - `sfpm project` prints an overview of packages and their dependency graph.
19
+ - `sfpm project init` is read-only: it verifies project setup (git, remote, sfdx-project.json,
20
+ packages). `--fix` does not change anything; it only prints guidance for each failed check.
21
+ - `sfpm project init turbo` scaffolds a turbo-based workspace, or migrates one with `--migrate`.
22
+ It writes root and per-package `sfpm:*` scripts and a `turbo.json` with sfpm task definitions.
23
+
24
+ ## Orchestration with Turborepo
25
+
26
+ Run work across the whole workspace through turbo so its caching and dependency graph apply:
27
+
28
+ - `turbo run sfpm:build` (or root `pnpm sfpm:build`) builds packages in dependency order.
29
+ - `turbo run sfpm:deploy` (or `pnpm sfpm:deploy`) deploys from local source.
30
+ - `turbo run sfpm:install` (or `pnpm sfpm:install`) installs into an org; it depends on `sfpm:build`.
31
+ - Scope to changed packages with turbo filters, e.g. `turbo run sfpm:build --filter=...[origin/main]`
32
+ or `--filter=<package-name>...` to include dependencies.
33
+ - Per-package scripts call `sfpm <verb> <pkg> --turbo`. That flag is for turbo-invoked scripts only:
34
+ single-package mode, plain output, and a result file written to `dist/<command>-result.json`.
35
+ Do not pass `--turbo` by hand.
36
+ - For ad-hoc work, call sfpm directly (`sfpm build <pkgs>`, `sfpm deploy <pkgs>`). sfpm resolves
37
+ package dependencies itself, so you do not need turbo for a handful of packages.
38
+
39
+ ## Tests
40
+
41
+ Tests are NOT an sfpm command. Each package defines its own `test` script in its `package.json`
42
+ (Apex tests, Jest for LWC via `@b64hub/sfpm-jest`, etc.). Run them with `turbo run test`
43
+ (or `pnpm test` at the root). Turbo runs `build` first (`dependsOn: ["build"]`) and caches results.
44
+ Scope with turbo filters, e.g. `turbo run test --filter=<package-name>`.
45
+
46
+ ## Common sequences
47
+
48
+ 1. New workspace, first time: `sfpm project init` (verify), then `sfpm project init turbo` (scaffold),
49
+ then `sfpm project sync` (regenerate `sfdx-project.json`), then `sfpm project` (confirm the graph).
50
+ 2. Change one package and check it: `sfpm build <pkg>`, then `sfpm deploy <pkg> --target-org <alias>`
51
+ against a scratch org or sandbox the user has confirmed.
52
+ 3. Whole-workspace CI-style run: `turbo run sfpm:build --filter=...[origin/main]`, then
53
+ `turbo run test`, with the same filter.
54
+ 4. Cut a release: `sfpm build <pkgs>`, `sfpm release create -n <name>`, review the generated YAML, then
55
+ `sfpm release run release/<name>.yaml --target-org <alias>` after confirming the org.
56
+
57
+ ## Agent conventions
58
+
59
+ - Pass `--json` for machine-readable output. The result is wrapped in an envelope:
60
+ `{command, duration, status, result, error}`. `status` is `success` or `error`; read `error.message` on failure.
61
+ - Pass `--plain` for non-interactive output. It is also automatic in CI and when stdout is not a TTY.
62
+ - Detailed run logs are written to `.sfpm/logs/<runId>.log` (full-fidelity JSON lines). When a
63
+ command fails and the console output is not enough, read the newest file there.
64
+ - Commands that take `--log-level` (or `SFPM_LOG_LEVEL`) print more diagnostics to stderr.
65
+
66
+ ## Command workflows
67
+
68
+ - **Package creation**: `sfpm package create` scaffolds a new package in the workspace (interactive
69
+ unless flags are given; `--json` for CI). `sfpm add <pkgs>` adds sfpm packages as dependencies of the
70
+ current project using pnpm.
71
+ - **Build**: `sfpm build <pkgs>` builds packages and their dependencies, and validates them. Use
72
+ `--async` to return immediately while validation runs in a background watcher. Check progress with
73
+ `sfpm build status`. Manage background watchers with `sfpm watch status`, `sfpm watch cancel`,
74
+ and `sfpm watch clean` (removes completed, errored, and orphaned watcher state files).
75
+ - **Deploy**: `sfpm deploy <pkgs> --target-org <alias>` deploys packages from local project source.
76
+ `sfpm deploy artifact <pkgs> --target-org <alias>` deploys from packages that were already built,
77
+ so the source you deploy is exactly the built artifact.
78
+ - **Install**: `sfpm install <pkgs> --target-org <alias>` installs built package versions into an org,
79
+ including their dependencies unless `--no-dependencies` is passed.
80
+ - **Publish**: `sfpm publish [pkgs]` publishes packages from their `dist` directories (no args or `all` means every workspace package). Use `--dry-run` first; `--tag` sets the npm dist-tag (default `latest`).
81
+ - **Releases**: `sfpm release create -n <name> [pkgs]` resolves each package's version from git tags (`--ref`, default `main`) and writes `release/<name>.yaml`; with no selection flags in a terminal it runs a guided walkthrough.
82
+ `sfpm release run <file> --target-org <alias>` installs the packages listed in that definition.
83
+ - **Scratch org pools**: `sfpm pool fill --tag <tag> --max <n> -d <scratch-def> -v <devhub>` creates
84
+ orgs in a pool. `sfpm pool list [--tag <tag>]` shows pool contents. `sfpm pool fetch --tag <tag>` takes an org
85
+ out of the pool for use. `sfpm pool delete` removes orgs from a pool.
86
+ - **Versioning**: `sfpm project version bump` bumps package versions in `sfdx-project.json` (which is
87
+ regenerated from the workspace; see Workspace model).
88
+ - **Bootstrap**: `sfpm bootstrap -o <org>` brings the packages into a production org, tier by tier. The org must also be a DevHub. It decides per package whether to build, promote, install, or skip, based on DevHub and target org state, and reruns skip packages already done.
89
+
90
+ ## Safety rules
91
+
92
+ - `sfpm deploy`, `sfpm install`, `sfpm release run`, `sfpm bootstrap`, `sfpm publish`, and
93
+ `sfpm pool delete` change real orgs, registries, or scratch org pools. Before running any of them,
94
+ confirm the target org alias, DevHub, or registry with the user.
95
+ - Never run `sfpm pool delete` (or any destructive pool operation) without asking first.
96
+ - Do not run `sfpm bootstrap --force` (rebuilds, re-promotes, and re-installs everything) or `sfpm build --force`
97
+ (builds with no source changes) unless the user asked for it.
98
+ - Do not edit `.sfpm/` state files or `sfdx-project.json` by hand; regenerate or rerun the command instead.
99
+ - Do not commit `.sfpm/`, `.sfdx/`, `.sf/`, or generated artifacts.
100
+
101
+ ## Flags
102
+
103
+ Run `sfpm <command> --help` for the full flag list of any command. The flags are generated from the
104
+ command definitions and stay in sync with the CLI; do not copy them from memory.