@effect-app/cli 1.26.3 → 1.26.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @effect-app/cli
2
2
 
3
+ ## 1.26.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 7da965e: better multi-tenant handling (multi env, different caches)
8
+
9
+ ## 1.26.4
10
+
11
+ ### Patch Changes
12
+
13
+ - 36aba87: move gh presence check when logging in because of freakin' services initializations
14
+
3
15
  ## 1.26.3
4
16
 
5
17
  ### Patch Changes
package/dist/gist.d.ts CHANGED
@@ -4,15 +4,19 @@ import { RunCommandService } from "./os-command.js";
4
4
  declare const GistEntry_base: Schema.Class<GistEntry, {
5
5
  description: typeof Schema.String;
6
6
  public: typeof Schema.Boolean;
7
+ company: typeof Schema.String;
7
8
  files: Schema.Array$<typeof Schema.String>;
8
9
  }, Schema.Struct.Encoded<{
9
10
  description: typeof Schema.String;
10
11
  public: typeof Schema.Boolean;
12
+ company: typeof Schema.String;
11
13
  files: Schema.Array$<typeof Schema.String>;
12
14
  }>, never, {
13
15
  readonly description: string;
14
16
  } & {
15
17
  readonly public: boolean;
18
+ } & {
19
+ readonly company: string;
16
20
  } & {
17
21
  readonly files: readonly string[];
18
22
  }, {}, {}>;
@@ -21,6 +25,7 @@ export declare class GistEntry extends GistEntry_base {
21
25
  declare const GistEntryDecoded_base: Schema.Class<GistEntryDecoded, {
22
26
  description: typeof Schema.String;
23
27
  public: typeof Schema.Boolean;
28
+ company: typeof Schema.String;
24
29
  files: Schema.Array$<typeof Schema.String>;
25
30
  } & {
26
31
  files_with_name: Schema.Array$<Schema.Struct<{
@@ -30,11 +35,14 @@ declare const GistEntryDecoded_base: Schema.Class<GistEntryDecoded, {
30
35
  }, Schema.Struct.Encoded<{
31
36
  description: typeof Schema.String;
32
37
  public: typeof Schema.Boolean;
38
+ company: typeof Schema.String;
33
39
  files: Schema.Array$<typeof Schema.String>;
34
40
  }>, never, {
35
41
  readonly description: string;
36
42
  } & {
37
43
  readonly public: boolean;
44
+ } & {
45
+ readonly company: string;
38
46
  } & {
39
47
  readonly files: readonly string[];
40
48
  } & {
@@ -67,19 +75,27 @@ declare const GistEntryDecoded_base: Schema.Class<GistEntryDecoded, {
67
75
  export declare class GistEntryDecoded extends GistEntryDecoded_base {
68
76
  }
69
77
  declare const GistYAML_base: Schema.Class<GistYAML, {
70
- gists: Schema.Record$<typeof Schema.String, typeof GistEntryDecoded>;
78
+ gists: Schema.optionalWith<Schema.Record$<typeof Schema.String, typeof GistEntryDecoded>, {
79
+ default: () => {};
80
+ nullable: true;
81
+ exact: true;
82
+ }>;
71
83
  settings: Schema.Struct<{
72
84
  token_env: typeof Schema.String;
73
85
  base_directory: typeof Schema.String;
74
86
  }>;
75
87
  }, Schema.Struct.Encoded<{
76
- gists: Schema.Record$<typeof Schema.String, typeof GistEntryDecoded>;
88
+ gists: Schema.optionalWith<Schema.Record$<typeof Schema.String, typeof GistEntryDecoded>, {
89
+ default: () => {};
90
+ nullable: true;
91
+ exact: true;
92
+ }>;
77
93
  settings: Schema.Struct<{
78
94
  token_env: typeof Schema.String;
79
95
  base_directory: typeof Schema.String;
80
96
  }>;
81
97
  }>, never, {
82
- readonly gists: {
98
+ readonly gists?: {
83
99
  readonly [x: string]: GistEntryDecoded;
84
100
  };
85
101
  } & {
@@ -101,31 +117,47 @@ declare const GistCacheEntry_base: Schema.Class<GistCacheEntry, {
101
117
  } & {
102
118
  readonly id: string;
103
119
  }, {}, {}>;
120
+ /**
121
+ * Cache entry representing a gist mapping.
122
+ * Each entry contains the gist's human-readable name and GitHub ID.
123
+ */
104
124
  export declare class GistCacheEntry extends GistCacheEntry_base {
105
125
  }
106
126
  export declare const GistCacheEntries: Schema.Array$<typeof GistCacheEntry>;
107
127
  export interface GistCacheEntries extends Schema.Schema.Type<typeof GistCacheEntries> {
108
128
  }
109
129
  /**
110
- * Gist cache mapping YAML configuration names to GitHub gist IDs.
130
+ * Gist cache mapping YAML configuration names to GitHub gist IDs with company awareness.
111
131
  *
112
132
  * Since GitHub gists don't have user-defined names, we maintain a cache
113
133
  * that maps the human-readable names from our YAML config to actual gist IDs.
134
+ * Each cache entry is associated with a company, enabling multi-tenant operations.
114
135
  * This allows us to:
115
136
  * - Update existing gists instead of creating duplicates
116
137
  * - Clean up obsolete entries when gists are removed from config
117
138
  * - Persist the name->ID mapping across CLI runs
139
+ * - Isolate gist operations by company context
118
140
  *
119
141
  * The cache itself is stored as a secret GitHub gist for persistence.
120
142
  */
121
143
  export declare class GistCache {
122
144
  entries: GistCacheEntries;
123
145
  gist_id: string;
124
- constructor({ entries, gist_id }: {
146
+ company: string;
147
+ constructor({ company, entries, gist_id }: {
125
148
  entries: GistCacheEntries;
126
149
  gist_id: string;
150
+ company: string;
127
151
  });
128
152
  }
153
+ declare const GistCacheOfCompanyNotFound_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
154
+ readonly _tag: "GistCacheOfCompanyNotFound";
155
+ } & Readonly<A>;
156
+ declare class GistCacheOfCompanyNotFound extends GistCacheOfCompanyNotFound_base<{
157
+ readonly message: string;
158
+ readonly cache_gist_id: string;
159
+ }> {
160
+ }
129
161
  declare const GHGistService_base: Effect.Service.Class<GHGistService, "GHGistService", {
130
162
  readonly dependencies: readonly [import("effect/Layer").Layer<RunCommandService, never, import("@effect/platform/CommandExecutor").CommandExecutor>];
131
163
  readonly effect: Effect.Effect<{
@@ -142,7 +174,10 @@ declare const GHGistService_base: Effect.Service.Class<GHGistService, "GHGistSer
142
174
  *
143
175
  * @returns An Effect that yields a GistCache containing the loaded cache entries and cache gist ID
144
176
  */
145
- loadGistCache: () => Effect.Effect.AsEffect<Effect.Effect<GistCache, never, never>>;
177
+ loadGistCache: (company: string, rec?: {
178
+ recCache?: boolean;
179
+ recCacheCompany?: boolean;
180
+ }) => Effect.Effect<GistCache, GistCacheOfCompanyNotFound, never>;
146
181
  /**
147
182
  * Saves the current gist cache state to the GitHub cache gist.
148
183
  * Updates the existing cache gist with the current mappings of names to gist IDs.
@@ -152,53 +187,68 @@ declare const GHGistService_base: Effect.Service.Class<GHGistService, "GHGistSer
152
187
  */
153
188
  saveGistCache: (cache: GistCache) => Effect.Effect<void, never, never>;
154
189
  /**
155
- * Creates a new GitHub gist with the specified files and updates the local cache.
156
- * Generates a GitHub CLI command to create the gist and extracts the resulting gist ID.
190
+ * Creates a new GitHub gist with the specified files and renames them with environment prefixes.
191
+ * Generates a GitHub CLI command to create the gist, extracts the resulting gist ID,
192
+ * and renames all files with environment prefixes for multi-environment support.
157
193
  *
158
- * @param cache - The current GistCache instance
159
- * @param name - The human-readable name for this gist (used in cache mapping)
194
+ * @param gist_name - The human-readable name for this gist (used in cache mapping)
160
195
  * @param description - The description for the GitHub gist
161
- * @param files - Array of file paths to include in the gist
196
+ * @param files - Array of file objects with path and name properties to include in the gist
162
197
  * @param is_public - Whether the gist should be public or private
163
- * @returns An Effect that yields an updated GistCache with the new gist entry
198
+ * @param env - Environment prefix to prepend to file names (e.g., "local-dev", "prod")
199
+ * @returns An Effect that yields a gist entry object with name and id properties
164
200
  */
165
201
  createGistWithFiles: (args_0: {
166
202
  gist_name: string;
167
203
  description: string;
168
- files: string[];
204
+ files: {
205
+ path: string;
206
+ name: string;
207
+ }[];
169
208
  is_public: boolean;
170
- cache: GistCache;
171
- }) => Effect.Effect<GistCache, never, never>;
209
+ env: string;
210
+ }) => Effect.Effect<{
211
+ name: string;
212
+ id: string;
213
+ }, never, never>;
172
214
  /**
173
- * Retrieves file names from a GitHub gist.
174
- * Fetches the list of files contained in the specified gist.
215
+ * Retrieves file names from a GitHub gist, filtered by environment prefix.
216
+ * Fetches the list of files contained in the specified gist and returns only
217
+ * those that match the current environment, with the environment prefix removed.
175
218
  *
176
219
  * @param gist_id - The GitHub gist ID to retrieve file names from
177
220
  * @param gist_name - The human-readable name of the gist (for logging purposes)
178
- * @returns An Effect that yields an array of file names
221
+ * @param env - Environment prefix to filter files by (e.g., "local-dev", "prod")
222
+ * @returns An Effect that yields an array of file names with environment prefix removed
179
223
  */
180
224
  getGistFileNames: (args_0: {
181
225
  gist_id: string;
182
226
  gist_name: string;
227
+ env: string;
183
228
  }) => Effect.Effect<string[], never, never>;
184
229
  /**
185
230
  * Removes a file from a specified GitHub gist.
231
+ * The file name is automatically prefixed with the environment when removing.
186
232
  * @param gist_id - The ID of the gist to modify
187
233
  * @param gist_name - The human-readable name of the gist (for logging purposes)
188
- * @param file_name - The name of the file to remove from the gist
234
+ * @param file_name - The base name of the file to remove (without environment prefix)
235
+ * @param env - Environment prefix that was used when the file was added
189
236
  * @returns An Effect that succeeds when the file is removed
190
237
  */
191
238
  removeFileFromGist: (args_0: {
192
239
  gist_id: string;
193
240
  gist_name: string;
194
241
  file_name: string;
242
+ env: string;
195
243
  }) => Effect.Effect<void, never, never>;
196
244
  /**
197
245
  * Updates a file in a specified GitHub gist.
246
+ * The file name is automatically prefixed with the environment when updating.
198
247
  * @param gist_id - The ID of the gist to modify
199
248
  * @param gist_name - The human-readable name of the gist (for logging purposes)
200
- * @param file_name - The name of the file to remove from the gist
249
+ * @param file_name - The base name of the file to update (without environment prefix)
201
250
  * @param file_path - The local path of the file to update in the gist
251
+ * @param env - Environment prefix that was used when the file was added
202
252
  * @returns An Effect that succeeds when the file is updated
203
253
  */
204
254
  updateFileOfGist: (args_0: {
@@ -206,18 +256,35 @@ declare const GHGistService_base: Effect.Service.Class<GHGistService, "GHGistSer
206
256
  gist_name: string;
207
257
  file_name: string;
208
258
  file_path: string;
259
+ env: string;
209
260
  }) => Effect.Effect<void, never, never>;
210
261
  /**
211
262
  * Adds a new file to a specified GitHub gist.
263
+ * The file is automatically renamed with an environment prefix for multi-environment support.
212
264
  * @param gist_id - The ID of the gist to modify
213
265
  * @param gist_name - The human-readable name of the gist (for logging purposes)
214
- * @param file_path - The local path of the file to add to the gist
215
- * @returns An Effect that succeeds when the file is added
266
+ * @param file - The file object containing path and name properties
267
+ * @param env - Environment prefix to prepend to the file name
268
+ * @returns An Effect that succeeds when the file is added and renamed
216
269
  */
217
270
  addFileToGist: (args_0: {
218
271
  gist_id: string;
219
272
  gist_name: string;
220
- file_path: string;
273
+ file: {
274
+ path: string;
275
+ name: string;
276
+ };
277
+ env: string;
278
+ }) => Effect.Effect<void, never, never>;
279
+ /**
280
+ * Deletes a specified GitHub gist by its ID.
281
+ * @param gist_id - The ID of the gist to delete
282
+ * @param gist_name - The human-readable name of the gist (for logging purposes)
283
+ * @returns An Effect that succeeds when the gist is deleted
284
+ */
285
+ deleteGist: (args_0: {
286
+ gist_id: string;
287
+ gist_name: string;
221
288
  }) => Effect.Effect<void, never, never>;
222
289
  }, never, RunCommandService>;
223
290
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"gist.d.ts","sourceRoot":"","sources":["../src/gist.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAEnD,OAAO,EAAuB,MAAM,EAAU,WAAW,EAAkB,MAAM,EAAmB,MAAM,QAAQ,CAAA;AAIlH,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;;;;;;;;;;;;;;;;AAOnD,qBAAa,SAAU,SAAQ,cAI7B;CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEL;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,gBAAiB,SAAQ,qBAoDpC;CAAG;;;;;;;;;;;;;;;;;;;;;;;AAEL,qBAAa,QAAS,SAAQ,aAS5B;CAAG;;;;;;;;;;;;AAEL,qBAAa,cAAe,SAAQ,mBAGlC;CAAG;AAEL,eAAO,MAAM,gBAAgB,sCAA+B,CAAA;AAC5D,MAAM,WAAW,gBAAiB,SAAQ,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gBAAgB,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