@effect-app/cli 1.25.0 → 1.26.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 (37) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/gist.d.ts +231 -0
  3. package/dist/gist.d.ts.map +1 -0
  4. package/dist/gist.js +447 -0
  5. package/dist/index.js +38 -65
  6. package/dist/os-command.d.ts +18 -0
  7. package/dist/os-command.d.ts.map +1 -0
  8. package/dist/os-command.js +47 -0
  9. package/package.json +11 -17
  10. package/src/gist.ts +615 -0
  11. package/src/index.ts +56 -73
  12. package/src/os-command.ts +63 -0
  13. package/test.gists.yaml +20 -0
  14. package/dist/link.d.ts +0 -2
  15. package/dist/link.d.ts.map +0 -1
  16. package/dist/link.js +0 -17
  17. package/dist/old.d.ts +0 -2
  18. package/dist/old.d.ts.map +0 -1
  19. package/dist/old.js +0 -246
  20. package/dist/sync.d.ts +0 -2
  21. package/dist/sync.d.ts.map +0 -1
  22. package/dist/sync.js +0 -16
  23. package/dist/unlink.d.ts +0 -2
  24. package/dist/unlink.d.ts.map +0 -1
  25. package/dist/unlink.js +0 -13
  26. package/src/link.ts +0 -20
  27. package/src/old.ts +0 -283
  28. package/src/sync.ts +0 -17
  29. package/src/unlink.ts +0 -14
  30. package/vitest.config.ts.timestamp-1709838404819-f2fb28517168c.mjs +0 -33
  31. package/vitest.config.ts.timestamp-1709838418683-9c399c96f9d78.mjs +0 -33
  32. package/vitest.config.ts.timestamp-1709838649058-0e8f9431c893d.mjs +0 -33
  33. package/vitest.config.ts.timestamp-1711724061889-4985ba59def8.mjs +0 -37
  34. package/vitest.config.ts.timestamp-1711743471019-3c5e0c6ca2188.mjs +0 -37
  35. package/vitest.config.ts.timestamp-1711743489536-5ca18d3f67759.mjs +0 -37
  36. package/vitest.config.ts.timestamp-1711743593444-e40a8dcd4fc31.mjs +0 -37
  37. package/vitest.config.ts.timestamp-1711744615239-6a156fd39b9c9.mjs +0 -37
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @effect-app/cli
2
2
 
3
+ ## 1.26.1
4
+
5
+ ### Patch Changes
6
+
7
+ - d1a6901: check gh presence
8
+
9
+ ## 1.26.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 2bcc323: add cli gist command to work with github gist files
14
+
3
15
  ## 1.25.0
4
16
 
5
17
  ### Minor Changes
package/dist/gist.d.ts ADDED
@@ -0,0 +1,231 @@
1
+ import { FileSystem, Path } from "@effect/platform";
2
+ import { Effect, ParseResult, Schema } from "effect";
3
+ import { RunCommandService } from "./os-command.js";
4
+ declare const GistEntry_base: Schema.Class<GistEntry, {
5
+ description: typeof Schema.String;
6
+ public: typeof Schema.Boolean;
7
+ files: Schema.Array$<typeof Schema.String>;
8
+ }, Schema.Struct.Encoded<{
9
+ description: typeof Schema.String;
10
+ public: typeof Schema.Boolean;
11
+ files: Schema.Array$<typeof Schema.String>;
12
+ }>, never, {
13
+ readonly description: string;
14
+ } & {
15
+ readonly public: boolean;
16
+ } & {
17
+ readonly files: readonly string[];
18
+ }, {}, {}>;
19
+ export declare class GistEntry extends GistEntry_base {
20
+ }
21
+ declare const GistEntryDecoded_base: Schema.Class<GistEntryDecoded, {
22
+ description: typeof Schema.String;
23
+ public: typeof Schema.Boolean;
24
+ files: Schema.Array$<typeof Schema.String>;
25
+ } & {
26
+ files_with_name: Schema.Array$<Schema.Struct<{
27
+ path: typeof Schema.String;
28
+ name: typeof Schema.String;
29
+ }>>;
30
+ }, Schema.Struct.Encoded<{
31
+ description: typeof Schema.String;
32
+ public: typeof Schema.Boolean;
33
+ files: Schema.Array$<typeof Schema.String>;
34
+ }>, never, {
35
+ readonly description: string;
36
+ } & {
37
+ readonly public: boolean;
38
+ } & {
39
+ readonly files: readonly string[];
40
+ } & {
41
+ readonly files_with_name: readonly {
42
+ readonly name: string;
43
+ readonly path: string;
44
+ }[];
45
+ }, GistEntry, {}>;
46
+ /**
47
+ * Extended gist entry that validates file_name uniqueness and extracts base filenames.
48
+ *
49
+ * GitHub Gists have a flat file structure and do not support directories/folders.
50
+ * All files within a gist must exist in the same namespace, meaning that files
51
+ * with identical names will collide, even if they originate from different local
52
+ * directories. When multiple files share the same basename, GitHub will either:
53
+ * - Reject the gist creation
54
+ * - Silently overwrite files (last one wins)
55
+ * - Display unpredictable behavior
56
+ *
57
+ * This validation prevents such collisions by detecting when multiple file paths
58
+ * would result in the same file_name when flattened to the gist structure.
59
+ *
60
+ * @example
61
+ * // These paths would collide in a gist
62
+ * ["src/config.json", "dist/config.json"] // Both become "config.json"
63
+ *
64
+ * @see {@link https://docs.github.com/articles/creating-gists | GitHub Gist Documentation}
65
+ * @see {@link https://github.com/orgs/community/discussions/29584 | Community Discussion on Gist Folder Support}
66
+ */
67
+ export declare class GistEntryDecoded extends GistEntryDecoded_base {
68
+ }
69
+ declare const GistYAML_base: Schema.Class<GistYAML, {
70
+ gists: Schema.Record$<typeof Schema.String, typeof GistEntryDecoded>;
71
+ settings: Schema.Struct<{
72
+ token_env: typeof Schema.String;
73
+ base_directory: typeof Schema.String;
74
+ }>;
75
+ }, Schema.Struct.Encoded<{
76
+ gists: Schema.Record$<typeof Schema.String, typeof GistEntryDecoded>;
77
+ settings: Schema.Struct<{
78
+ token_env: typeof Schema.String;
79
+ base_directory: typeof Schema.String;
80
+ }>;
81
+ }>, never, {
82
+ readonly gists: {
83
+ readonly [x: string]: GistEntryDecoded;
84
+ };
85
+ } & {
86
+ readonly settings: {
87
+ readonly token_env: string;
88
+ readonly base_directory: string;
89
+ };
90
+ }, {}, {}>;
91
+ export declare class GistYAML extends GistYAML_base {
92
+ }
93
+ declare const GistCacheEntry_base: Schema.Class<GistCacheEntry, {
94
+ name: typeof Schema.String;
95
+ id: typeof Schema.String;
96
+ }, Schema.Struct.Encoded<{
97
+ name: typeof Schema.String;
98
+ id: typeof Schema.String;
99
+ }>, never, {
100
+ readonly name: string;
101
+ } & {
102
+ readonly id: string;
103
+ }, {}, {}>;
104
+ export declare class GistCacheEntry extends GistCacheEntry_base {
105
+ }
106
+ export declare const GistCacheEntries: Schema.Array$<typeof GistCacheEntry>;
107
+ export interface GistCacheEntries extends Schema.Schema.Type<typeof GistCacheEntries> {
108
+ }
109
+ /**
110
+ * Gist cache mapping YAML configuration names to GitHub gist IDs.
111
+ *
112
+ * Since GitHub gists don't have user-defined names, we maintain a cache
113
+ * that maps the human-readable names from our YAML config to actual gist IDs.
114
+ * This allows us to:
115
+ * - Update existing gists instead of creating duplicates
116
+ * - Clean up obsolete entries when gists are removed from config
117
+ * - Persist the name->ID mapping across CLI runs
118
+ *
119
+ * The cache itself is stored as a secret GitHub gist for persistence.
120
+ */
121
+ export declare class GistCache {
122
+ entries: GistCacheEntries;
123
+ gist_id: string;
124
+ constructor({ entries, gist_id }: {
125
+ entries: GistCacheEntries;
126
+ gist_id: string;
127
+ });
128
+ }
129
+ declare const GHGistService_base: Effect.Service.Class<GHGistService, "GHGistService", {
130
+ readonly dependencies: readonly [import("effect/Layer").Layer<RunCommandService, never, import("@effect/platform/CommandExecutor").CommandExecutor>];
131
+ readonly effect: Effect.Effect<{
132
+ /**
133
+ * Loads the gist cache from GitHub, containing mappings of YAML configuration names to gist IDs.
134
+ * If no cache exists, creates a new empty cache gist.
135
+ *
136
+ * @returns An Effect that yields a GistCache containing the loaded cache entries and cache gist ID
137
+ */
138
+ loadGistCache: () => Effect.Effect.AsEffect<Effect.Effect<GistCache, never, never>>;
139
+ /**
140
+ * Saves the current gist cache state to the GitHub cache gist.
141
+ * Updates the existing cache gist with the current mappings of names to gist IDs.
142
+ *
143
+ * @param cache - The GistCache instance to save
144
+ * @returns An Effect that succeeds when the cache is successfully saved
145
+ */
146
+ saveGistCache: (cache: GistCache) => Effect.Effect<void, never, never>;
147
+ /**
148
+ * Creates a new GitHub gist with the specified files and updates the local cache.
149
+ * Generates a GitHub CLI command to create the gist and extracts the resulting gist ID.
150
+ *
151
+ * @param cache - The current GistCache instance
152
+ * @param name - The human-readable name for this gist (used in cache mapping)
153
+ * @param description - The description for the GitHub gist
154
+ * @param files - Array of file paths to include in the gist
155
+ * @param is_public - Whether the gist should be public or private
156
+ * @returns An Effect that yields an updated GistCache with the new gist entry
157
+ */
158
+ createGistWithFiles: (args_0: {
159
+ gist_name: string;
160
+ description: string;
161
+ files: string[];
162
+ is_public: boolean;
163
+ cache: GistCache;
164
+ }) => Effect.Effect<GistCache, never, never>;
165
+ /**
166
+ * Retrieves file names from a GitHub gist.
167
+ * Fetches the list of files contained in the specified gist.
168
+ *
169
+ * @param gist_id - The GitHub gist ID to retrieve file names from
170
+ * @param gist_name - The human-readable name of the gist (for logging purposes)
171
+ * @returns An Effect that yields an array of file names
172
+ */
173
+ getGistFileNames: (args_0: {
174
+ gist_id: string;
175
+ gist_name: string;
176
+ }) => Effect.Effect<string[], never, never>;
177
+ /**
178
+ * Removes a file from a specified GitHub gist.
179
+ * @param gist_id - The ID of the gist to modify
180
+ * @param gist_name - The human-readable name of the gist (for logging purposes)
181
+ * @param file_name - The name of the file to remove from the gist
182
+ * @returns An Effect that succeeds when the file is removed
183
+ */
184
+ removeFileFromGist: (args_0: {
185
+ gist_id: string;
186
+ gist_name: string;
187
+ file_name: string;
188
+ }) => Effect.Effect<void, never, never>;
189
+ /**
190
+ * Updates a file in a specified GitHub gist.
191
+ * @param gist_id - The ID of the gist to modify
192
+ * @param gist_name - The human-readable name of the gist (for logging purposes)
193
+ * @param file_name - The name of the file to remove from the gist
194
+ * @param file_path - The local path of the file to update in the gist
195
+ * @returns An Effect that succeeds when the file is updated
196
+ */
197
+ updateFileOfGist: (args_0: {
198
+ gist_id: string;
199
+ gist_name: string;
200
+ file_name: string;
201
+ file_path: string;
202
+ }) => Effect.Effect<void, never, never>;
203
+ /**
204
+ * Adds a new file to a specified GitHub gist.
205
+ * @param gist_id - The ID of the gist to modify
206
+ * @param gist_name - The human-readable name of the gist (for logging purposes)
207
+ * @param file_path - The local path of the file to add to the gist
208
+ * @returns An Effect that succeeds when the file is added
209
+ */
210
+ addFileToGist: (args_0: {
211
+ gist_id: string;
212
+ gist_name: string;
213
+ file_path: string;
214
+ }) => Effect.Effect<void, never, never>;
215
+ }, never, RunCommandService>;
216
+ }>;
217
+ declare class GHGistService extends GHGistService_base {
218
+ }
219
+ declare const GistHandler_base: Effect.Service.Class<GistHandler, "GistHandler", {
220
+ readonly accessors: true;
221
+ readonly dependencies: readonly [import("effect/Layer").Layer<GHGistService, never, import("@effect/platform/CommandExecutor").CommandExecutor>];
222
+ readonly effect: Effect.Effect<{
223
+ handler: (args_0: {
224
+ YAMLPath: string;
225
+ }) => Effect.Effect<undefined, import("@effect/platform/Error").PlatformError | Error | ParseResult.ParseError | import("effect/ConfigError").ConfigError, never>;
226
+ }, never, Path.Path | FileSystem.FileSystem | GHGistService>;
227
+ }>;
228
+ export declare class GistHandler extends GistHandler_base {
229
+ }
230
+ export {};
231
+ //# sourceMappingURL=gist.d.ts.map
@@ -0,0 +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,EAAQ,MAAM,EAAmB,MAAM,QAAQ,CAAA;AAGxG,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,CAAC;CAAG;AAExF;;;;;;;;;;;GAWG;AACH,qBAAa,SAAS;IACpB,OAAO,EAAE,gBAAgB,CAAA;IACzB,OAAO,EAAE,MAAM,CAAA;gBAEH,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,EAAE,gBAAgB,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CAIjF;;;;QAoPK;;;;;WAKG;;QAGH;;;;;;WAMG;;QAGH;;;;;;;;;;WAUG;;uBA3IU,MAAM;yBACJ,MAAM;mBACZ,MAAM,EAAE;uBACJ,OAAO;mBACX,SAAS;;QA0IlB;;;;;;;WAOG;;qBAzGQ,MAAM;uBACJ,MAAM;;QA2GnB;;;;;;WAMG;;qBApGQ,MAAM;uBACJ,MAAM;uBACN,MAAM;;QAqGnB;;;;;;;WAOG;;qBAnGQ,MAAM;uBACJ,MAAM;uBACN,MAAM;uBACN,MAAM;;QAmGnB;;;;;;WAMG;;qBArFQ,MAAM;uBACJ,MAAM;uBACN,MAAM;;;;AA/MzB,cAAM,aAAc,SAAQ,kBAsS1B;CAAG;;;;;;sBAcqF,MAAM;;;;AAXhG,qBAAa,WAAY,SAAQ,gBAmK/B;CAAG"}