@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.
- package/commands/bootstrap.d.ts.map +1 -1
- package/commands/bootstrap.js +16 -57
- package/commands/bootstrap.js.map +1 -1
- package/commands/config/context.d.ts.map +1 -1
- package/commands/config/context.js +41 -5
- package/commands/config/context.js.map +1 -1
- package/commands/install.js +1 -1
- package/commands/install.js.map +1 -1
- package/commands/push.js +1 -1
- package/commands/push.js.map +1 -1
- package/commands/search.d.ts.map +1 -1
- package/commands/search.js +0 -2
- package/commands/search.js.map +1 -1
- package/commands/up.js +1 -1
- package/commands/up.js.map +1 -1
- package/config/index.d.ts +1 -1
- package/config/index.d.ts.map +1 -1
- package/config/index.js +1 -1
- package/config/index.js.map +1 -1
- package/config/resolve.d.ts +8 -0
- package/config/resolve.d.ts.map +1 -1
- package/config/resolve.js +8 -8
- package/config/resolve.js.map +1 -1
- package/local/bootstrap.d.ts +9 -29
- package/local/bootstrap.d.ts.map +1 -1
- package/local/bootstrap.js +61 -69
- package/local/bootstrap.js.map +1 -1
- package/local/daemon/launch.d.ts +2 -2
- package/local/daemon/launch.d.ts.map +1 -1
- package/marketplace/official.d.ts.map +1 -1
- package/marketplace/official.js +6 -5
- package/marketplace/official.js.map +1 -1
- package/marketplace/render.d.ts.map +1 -1
- package/marketplace/render.js +0 -3
- package/marketplace/render.js.map +1 -1
- package/package.json +7 -7
- package/resources/search.d.ts +1 -3
- package/resources/search.d.ts.map +1 -1
- package/resources/search.js +0 -1
- package/resources/search.js.map +1 -1
- package/resources/share.d.ts.map +1 -1
- package/resources/share.js +20 -24
- package/resources/share.js.map +1 -1
- package/resources/skill.d.ts +2 -2
- package/resources/skill.d.ts.map +1 -1
- package/resources/skill.js +19 -10
- package/resources/skill.js.map +1 -1
- package/src/commands/bootstrap.test.ts +19 -75
- package/src/commands/bootstrap.ts +19 -68
- package/src/commands/config/context.test.ts +171 -0
- package/src/commands/config/context.ts +50 -5
- package/src/commands/install.ts +1 -1
- package/src/commands/marketplace.test.ts +2 -2
- package/src/commands/push.ts +1 -1
- package/src/commands/search.ts +0 -3
- package/src/commands/up.ts +1 -1
- package/src/config/index.ts +1 -0
- package/src/config/resolve.test.ts +2 -2
- package/src/config/resolve.ts +8 -8
- package/src/local/bootstrap.test.ts +132 -65
- package/src/local/bootstrap.ts +64 -139
- package/src/local/daemon/launch.ts +2 -2
- package/src/marketplace/official.ts +6 -5
- package/src/marketplace/read.test.ts +2 -3
- package/src/marketplace/render.ts +0 -3
- package/src/resources/apply/apply.test.ts +10 -10
- package/src/resources/read-completion.integration.test.ts +0 -2
- package/src/resources/search.ts +1 -4
- package/src/resources/share.test.ts +7 -60
- package/src/resources/share.ts +22 -27
- package/src/resources/skill.test.ts +20 -13
- package/src/resources/skill.ts +25 -14
- package/local/plugins/defaults.d.ts +0 -55
- package/local/plugins/defaults.d.ts.map +0 -1
- package/local/plugins/defaults.js +0 -111
- package/local/plugins/defaults.js.map +0 -1
- package/local/system-org.d.ts +0 -15
- package/local/system-org.d.ts.map +0 -1
- package/local/system-org.js +0 -57
- package/local/system-org.js.map +0 -1
- package/src/local/plugins/defaults.test.ts +0 -271
- package/src/local/plugins/defaults.ts +0 -179
- package/src/local/system-org.test.ts +0 -124
- package/src/local/system-org.ts +0 -63
package/src/local/system-org.ts
DELETED
|
@@ -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
|
-
}
|