kalup 0.1.0 → 0.2.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 (78) hide show
  1. package/README.md +19 -11
  2. package/dist/{commands-C--Xsk1p.mjs → commands-Bk1w1oup.mjs} +10579 -9638
  3. package/dist/commands.d.mts +5 -1
  4. package/dist/commands.mjs +1 -1
  5. package/dist/{context-D10Syqfd.d.mts → context-8pARDYRR.d.mts} +74 -7
  6. package/dist/{host-BJWvo3sX.mjs → host-BoqS00po.mjs} +1 -1
  7. package/dist/host.d.mts +1 -1
  8. package/dist/host.mjs +1 -1
  9. package/dist/index.mjs +1 -1
  10. package/dist/schemas/blueprint-1.schema.json +42 -4
  11. package/dist/schemas/blueprints-lock-1.schema.json +2 -2
  12. package/dist/schemas/ir-1.schema.json +42 -5
  13. package/dist/schemas/plan-1.schema.json +1 -1
  14. package/docs/apply.md +3 -3
  15. package/docs/blueprints.md +3 -3
  16. package/docs/compare.md +1 -1
  17. package/docs/config.md +32 -16
  18. package/docs/errors/E_BAD_CHAIN.md +1 -1
  19. package/docs/errors/E_BIOME_CONFIG.md +2 -2
  20. package/docs/errors/E_BLUEPRINT_ADDED.md +2 -2
  21. package/docs/errors/E_BLUEPRINT_INTEGRITY.md +1 -1
  22. package/docs/errors/E_BLUEPRINT_LOCK.md +3 -3
  23. package/docs/errors/E_BLUEPRINT_ORIGINAL.md +3 -3
  24. package/docs/errors/E_BLUEPRINT_SOURCE.md +1 -1
  25. package/docs/errors/E_BLUEPRINT_UNKNOWN.md +2 -2
  26. package/docs/errors/E_DEFINITION_FIELD.md +29 -0
  27. package/docs/errors/E_DIR_AMBIGUOUS.md +17 -0
  28. package/docs/errors/E_DIR_IN_USE.md +17 -0
  29. package/docs/errors/E_DUPLICATE_ADDRESS.md +1 -1
  30. package/docs/errors/E_DUPLICATE_ALIAS.md +1 -1
  31. package/docs/errors/E_DUPLICATE_KEY.md +1 -1
  32. package/docs/errors/E_DUPLICATE_OPTION.md +1 -1
  33. package/docs/errors/E_HS_PREFIX.md +1 -1
  34. package/docs/errors/E_KEY_COLLISION.md +1 -1
  35. package/docs/errors/E_LIFECYCLE.md +3 -3
  36. package/docs/errors/E_LOCKED.md +1 -1
  37. package/docs/errors/E_MISSING_EXPORT.md +4 -4
  38. package/docs/errors/E_MISSING_KEY.md +1 -1
  39. package/docs/errors/E_NOT_DATA.md +1 -1
  40. package/docs/errors/E_OVERRIDE_DEFINITION.md +2 -2
  41. package/docs/errors/E_PENDING_TARGET.md +17 -0
  42. package/docs/errors/E_PLAN_DELETE.md +1 -1
  43. package/docs/errors/E_PORTAL_ID.md +2 -2
  44. package/docs/errors/E_PREVENT_DESTROY.md +1 -1
  45. package/docs/errors/E_PROJECT_WRITE.md +1 -1
  46. package/docs/errors/E_PROTECTED_SAVED_PLAN.md +4 -4
  47. package/docs/errors/E_PULL_INVALID.md +1 -1
  48. package/docs/errors/E_REFERENCE_DEFINITION.md +1 -1
  49. package/docs/errors/E_RM_DEPENDENTS.md +1 -1
  50. package/docs/errors/E_SETTING_VALUE.md +3 -1
  51. package/docs/errors/E_STANDARD_OBJECT.md +1 -1
  52. package/docs/errors/E_STRICT_WITHOUT_OPTIONS.md +1 -1
  53. package/docs/errors/E_TARGET_PORTAL_MISMATCH.md +1 -1
  54. package/docs/errors/E_TOMBSTONE_ADDRESS.md +3 -3
  55. package/docs/errors/E_TOMBSTONE_CONFLICT.md +3 -3
  56. package/docs/errors/E_TYPE_FIELDTYPE.md +2 -2
  57. package/docs/errors/E_UNKNOWN_BUILDER.md +2 -2
  58. package/docs/errors/E_UNKNOWN_GROUP.md +1 -1
  59. package/docs/errors/E_UNKNOWN_INCLUDE.md +3 -1
  60. package/docs/errors/E_UNSUPPORTED_FILE.md +4 -4
  61. package/docs/errors/E_USAGE.md +1 -1
  62. package/docs/errors/E_WRITE_IN_READ_MODE.md +1 -1
  63. package/docs/errors/W_CODEC_MISMATCH.md +1 -1
  64. package/docs/errors/W_JSON_FIELDTYPE.md +1 -1
  65. package/docs/errors/W_LARGE_SCOPE.md +5 -5
  66. package/docs/errors/W_LEGACY_DIR.md +17 -0
  67. package/docs/errors/W_PENDING_TARGET.md +23 -0
  68. package/docs/errors/W_PREFIX.md +1 -1
  69. package/docs/errors/W_STATE_NOT_MOVED.md +17 -0
  70. package/docs/errors/W_UNADDRESSABLE_NAME.md +1 -1
  71. package/docs/errors/W_UNSUPPORTED_TYPE.md +3 -3
  72. package/docs/plan.md +2 -2
  73. package/docs/pull.md +9 -9
  74. package/docs/rm.md +3 -3
  75. package/docs/state.md +4 -2
  76. package/docs/targets.md +3 -3
  77. package/package.json +2 -8
  78. package/docs/errors/E_FIRST_PULL.md +0 -18
package/README.md CHANGED
@@ -7,29 +7,35 @@ Kalup keeps a HubSpot portal's properties, property groups and custom object sch
7
7
  ## Install
8
8
 
9
9
  ```sh
10
- npm install -D kalup @kalup/core # or: pnpm add -D kalup @kalup/core, or: yarn add -D kalup @kalup/core
10
+ npm install @kalup/core
11
+ npm install -D kalup
11
12
  ```
12
13
 
13
- Node 22.13.1 or later. If your app imports the files at run time, put `@kalup/core` in `dependencies` instead.
14
+ With pnpm, yarn or bun: `pnpm add @kalup/core && pnpm add -D kalup`, and the same with `yarn add` or `bun add`.
15
+
16
+ Node 22.13.1 or later. Your app imports `@kalup/core` at run time (7 kB, no dependencies), so it is a regular dependency. The `kalup` CLI is a dev tool. If you skip the first line, `kalup init` adds `@kalup/core` to `package.json` for you.
14
17
 
15
18
  ## First run
16
19
 
17
20
  Create a service key in HubSpot under Development > Keys > Service keys, with `crm.schemas.<object>.read` for each object you manage, the matching `.write` scopes to apply changes, and one `crm.objects.<object>.read` so `plan` can check the property limit. Put it in `.env` as `HUBSPOT_SERVICE_KEY`, then:
18
21
 
19
22
  ```sh
20
- npx kalup init --portal <portal-id> # check the key's portal, write kalup.config.ts, pull into kalup/objects/
21
- npx kalup plan --out plan.json # edit a file first; review every step
22
- npx kalup apply plan.json # type the target name to confirm
23
+ npx kalup init --portal <portal-id> # offline: write kalup.config.ts, hubspot/ and AGENTS.md
24
+ npx kalup pull # check the key's portal, write hubspot/objects/
25
+ npx kalup plan # edit a file first; review every step
26
+ npx kalup apply # plans again, then you type the target name to confirm
23
27
  ```
24
28
 
25
- `init` prints the exact scopes the key needs. Nothing is written to the portal until `apply`, and `apply` asks for one approval: a person at a terminal, `--yes` for a small safe change on an unprotected target, or `--approve` from a reviewed CI job. Every delete needs the person.
29
+ `init` needs no key and prints the exact scopes the key needs. `--dir lib/config/hubspot` puts the object files elsewhere. Nothing is written to the portal until `apply`, and `apply` asks for one approval: a person at a terminal, `--yes` for a small safe change on an unprotected target, or `--approve` from a reviewed CI job. Every delete needs the person. To review a plan before it runs, or to apply from CI, save it with `kalup plan --out` and apply the file.
30
+
31
+ Commit `kalup.config.ts` and `hubspot/`. Keep `.kalup/`, plan files and `.env` out of git; `init` adds the ignore lines.
26
32
 
27
33
  ## Commands
28
34
 
29
35
  | Command | What it does |
30
36
  |---|---|
31
- | `kalup init` | Create kalup.config.ts and pull the first target. |
32
- | `kalup pull` | Read a target and write kalup/objects/*.ts. |
37
+ | `kalup init` | Create kalup.config.ts and the project files. Offline: no key, no request. |
38
+ | `kalup pull` | Read a target and write the object files. |
33
39
  | `kalup validate` | Check the config files and report every issue. |
34
40
  | `kalup ir` | Print the IR document derived from the config files. |
35
41
  | `kalup fmt` | Rewrite config files in canonical form. |
@@ -38,8 +44,8 @@ npx kalup apply plan.json # type the target name to confirm
38
44
  | `kalup plan` | Show what apply would change on a target. |
39
45
  | `kalup snapshot` | Save a read of a target as a snapshot file. |
40
46
  | `kalup docs` | Write a Markdown data dictionary of the config or a snapshot. |
41
- | `kalup apply` | Apply a saved plan to its target, or plan and apply an unprotected target in one run. |
42
- | `kalup rm` | Take a property or group out of config and write its tombstone in kalup/removed.ts. |
47
+ | `kalup apply` | Apply a saved plan, or plan a target and apply it in one run after a person at a terminal confirms it. |
48
+ | `kalup rm` | Take a property or group out of config and write its tombstone in removed.ts. |
43
49
  | `kalup state rebuild` | Report what a target's portal holds against its state; --write replaces the state file. |
44
50
  | `kalup target rebind` | Point a target at a recreated test portal or sandbox. A terminal only. |
45
51
  | `kalup add` | Write a blueprint from a JSON file or https URL into the config files. Never touches a portal. |
@@ -47,10 +53,12 @@ npx kalup apply plan.json # type the target name to confirm
47
53
 
48
54
  `kalup <command> --help` lists each command's flags.
49
55
 
50
- ## What 0.1.0 covers
56
+ ## What 0.2 covers
51
57
 
52
58
  - Reads and writes properties and property groups on standard and custom objects. Custom object schemas are read and compared, not written.
59
+ - Every property definition field HubSpot lets you write, such as display hints, `hidden`, `displayOrder` and calculation formulas, checked against a live developer test account.
53
60
  - Takeover mode, `exclude`, `adopt: 'overwrite'` and `yesLimit` per target, lenient enums, blueprints and per-target overrides.
61
+ - State local to your machine by default, or committed with `state: 'repo'`. Monorepos and git worktrees.
54
62
  - Every command takes `--json` and prints one `envelope/1` document with stable issue codes and exit codes. The JSON Schemas ship as `kalup/schemas/<file>`.
55
63
 
56
64
  The pull, plan, apply and drift workflow passed [live runs](https://github.com/scopiousdigital/kalup/blob/main/docs/hubspot.md#live-runs) on a HubSpot developer test account; other account types are not verified yet. Pipelines, custom object schema writes and association labels are next. Before 1.0, a minor release may change the config grammar or the JSON output, and its release notes say so.