@stigmer/cli 3.23.0 → 3.24.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 (84) hide show
  1. package/commands/bootstrap.d.ts.map +1 -1
  2. package/commands/bootstrap.js +16 -57
  3. package/commands/bootstrap.js.map +1 -1
  4. package/commands/config/context.d.ts.map +1 -1
  5. package/commands/config/context.js +41 -5
  6. package/commands/config/context.js.map +1 -1
  7. package/commands/install.js +1 -1
  8. package/commands/install.js.map +1 -1
  9. package/commands/push.js +1 -1
  10. package/commands/push.js.map +1 -1
  11. package/commands/search.d.ts.map +1 -1
  12. package/commands/search.js +0 -2
  13. package/commands/search.js.map +1 -1
  14. package/commands/up.js +1 -1
  15. package/commands/up.js.map +1 -1
  16. package/config/index.d.ts +1 -1
  17. package/config/index.d.ts.map +1 -1
  18. package/config/index.js +1 -1
  19. package/config/index.js.map +1 -1
  20. package/config/resolve.d.ts +8 -0
  21. package/config/resolve.d.ts.map +1 -1
  22. package/config/resolve.js +8 -8
  23. package/config/resolve.js.map +1 -1
  24. package/local/bootstrap.d.ts +9 -29
  25. package/local/bootstrap.d.ts.map +1 -1
  26. package/local/bootstrap.js +61 -69
  27. package/local/bootstrap.js.map +1 -1
  28. package/local/daemon/launch.d.ts +2 -2
  29. package/local/daemon/launch.d.ts.map +1 -1
  30. package/marketplace/official.d.ts.map +1 -1
  31. package/marketplace/official.js +6 -5
  32. package/marketplace/official.js.map +1 -1
  33. package/marketplace/render.d.ts.map +1 -1
  34. package/marketplace/render.js +0 -3
  35. package/marketplace/render.js.map +1 -1
  36. package/package.json +7 -7
  37. package/resources/search.d.ts +1 -3
  38. package/resources/search.d.ts.map +1 -1
  39. package/resources/search.js +0 -1
  40. package/resources/search.js.map +1 -1
  41. package/resources/share.d.ts.map +1 -1
  42. package/resources/share.js +20 -24
  43. package/resources/share.js.map +1 -1
  44. package/resources/skill.d.ts +2 -2
  45. package/resources/skill.d.ts.map +1 -1
  46. package/resources/skill.js +19 -10
  47. package/resources/skill.js.map +1 -1
  48. package/src/commands/bootstrap.test.ts +19 -75
  49. package/src/commands/bootstrap.ts +19 -68
  50. package/src/commands/config/context.test.ts +171 -0
  51. package/src/commands/config/context.ts +50 -5
  52. package/src/commands/install.ts +1 -1
  53. package/src/commands/marketplace.test.ts +2 -2
  54. package/src/commands/push.ts +1 -1
  55. package/src/commands/search.ts +0 -3
  56. package/src/commands/up.ts +1 -1
  57. package/src/config/index.ts +1 -0
  58. package/src/config/resolve.test.ts +2 -2
  59. package/src/config/resolve.ts +8 -8
  60. package/src/local/bootstrap.test.ts +132 -65
  61. package/src/local/bootstrap.ts +64 -139
  62. package/src/local/daemon/launch.ts +2 -2
  63. package/src/marketplace/official.ts +6 -5
  64. package/src/marketplace/read.test.ts +2 -3
  65. package/src/marketplace/render.ts +0 -3
  66. package/src/resources/apply/apply.test.ts +10 -10
  67. package/src/resources/read-completion.integration.test.ts +0 -2
  68. package/src/resources/search.ts +1 -4
  69. package/src/resources/share.test.ts +7 -60
  70. package/src/resources/share.ts +22 -27
  71. package/src/resources/skill.test.ts +20 -13
  72. package/src/resources/skill.ts +25 -14
  73. package/local/plugins/defaults.d.ts +0 -55
  74. package/local/plugins/defaults.d.ts.map +0 -1
  75. package/local/plugins/defaults.js +0 -111
  76. package/local/plugins/defaults.js.map +0 -1
  77. package/local/system-org.d.ts +0 -15
  78. package/local/system-org.d.ts.map +0 -1
  79. package/local/system-org.js +0 -57
  80. package/local/system-org.js.map +0 -1
  81. package/src/local/plugins/defaults.test.ts +0 -271
  82. package/src/local/plugins/defaults.ts +0 -179
  83. package/src/local/system-org.test.ts +0 -124
  84. package/src/local/system-org.ts +0 -63
@@ -1,63 +0,0 @@
1
- // The system organization, as code: the one `stigmer` org every Stigmer
2
- // backend carries, which the official default plugins are installed into
3
- // and the local CLI falls back to when no org is configured.
4
- //
5
- // This is the only place the org is defined. The bootstrap creates it when
6
- // a backend does not have it (a fresh local data dir, a raw self-hosted
7
- // server); on the hosted platform it already exists, owned by IAM, and the
8
- // create never fires. Its slug is the same in both editions, so nothing
9
- // here is configurable: a bootstrap that could be pointed at another org
10
- // would put the platform's public defaults where no cross-org lookup finds
11
- // them.
12
- //
13
- // "Ensure" is find-then-create with the race closed by the server: two
14
- // launchers racing the same check see one `already-exists`, and that IS the
15
- // desired end state, so it is reported as `present`, never rethrown. Any
16
- // other refusal (a self-hosted authorizer that denies the reserved label,
17
- // a backend that refuses the create) propagates with the server's sentence;
18
- // the caller decides how loud to be.
19
-
20
- import { ManagementMode } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/enum_pb";
21
- import { type Stigmer, StigmerError } from "@stigmer/sdk";
22
-
23
- /** The system organization's slug, identical across editions. */
24
- export const SYSTEM_ORG = "stigmer";
25
-
26
- /**
27
- * Marks the system org so an operator can tell it from a user's own org in
28
- * any listing. Informational: no server or client code path reads it.
29
- */
30
- export const SYSTEM_ORG_LABEL = "stigmer.ai/system";
31
-
32
- export type EnsureSystemOrgOutcome = "present" | "created";
33
-
34
- /**
35
- * Make sure the system organization exists on the backend `stigmer` is bound
36
- * to. Idempotent; a lost create race counts as `present`.
37
- */
38
- export async function ensureSystemOrg(
39
- stigmer: Stigmer,
40
- ): Promise<EnsureSystemOrgOutcome> {
41
- const mine = await stigmer.organization.findMyOrganizations();
42
- if (mine.entries.some((org) => org.metadata?.slug === SYSTEM_ORG)) {
43
- return "present";
44
- }
45
- try {
46
- // Organizations are self-owning: the org field is the slug itself, the
47
- // shape the console's create form and the e2e harness both use.
48
- await stigmer.organization.create({
49
- name: "Stigmer",
50
- slug: SYSTEM_ORG,
51
- org: SYSTEM_ORG,
52
- description: "System organization for Stigmer installations",
53
- labels: { [SYSTEM_ORG_LABEL]: "true" },
54
- managementMode: ManagementMode.self_managed,
55
- });
56
- return "created";
57
- } catch (error) {
58
- if (error instanceof StigmerError && error.code === "already-exists") {
59
- return "present";
60
- }
61
- throw error;
62
- }
63
- }