fireflyy 3.0.11 → 4.0.0-dev.fd79cb3

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.
@@ -1,157 +1,163 @@
1
1
  {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "type": "object",
4
- "properties": {
5
- "repository": {
6
- "description": "Repo in 'owner/repo' format, auto-detected if omitted.",
7
- "default": "",
8
- "anyOf": [
9
- {
10
- "type": "string",
11
- "pattern": "^[\\w.-]+\\/[\\w.-]+$"
12
- },
13
- {
14
- "type": "string",
15
- "const": ""
16
- }
17
- ]
18
- },
19
- "verbose": {
20
- "description": "Enable verbose logging.",
21
- "default": false,
22
- "type": "boolean"
23
- },
24
- "dryRun": {
25
- "description": "Simulate execution without changes.",
26
- "default": false,
27
- "type": "boolean"
28
- },
29
- "branch": {
30
- "description": "Branch to run on, defaults to current.",
31
- "type": "string"
32
- },
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "cwd": {
6
+ "description": "The working directory for all operations.",
7
+ "type": "string"
8
+ },
9
+ "dryRun": {
10
+ "description": "Run without making actual changes.",
11
+ "type": "boolean"
12
+ },
13
+ "verbose": {
14
+ "description": "Enable verbose logging output.",
15
+ "type": "boolean"
16
+ },
17
+ "enableRollback": {
18
+ "description": "Automatically rollback on failure.",
19
+ "type": "boolean"
20
+ },
21
+ "release": {
22
+ "description": "Release command configuration.",
23
+ "type": "object",
24
+ "properties": {
33
25
  "name": {
34
- "description": "Unscoped project name. Auto-detected from package.json.",
35
- "type": "string"
26
+ "description": "Unscoped project name. Auto-detected from package.json.",
27
+ "type": "string"
36
28
  },
37
29
  "scope": {
38
- "description": "Org/user scope without \"@\". Auto-detected from package.json.",
39
- "type": "string"
30
+ "description": "Org/user scope without '@'. Auto-detected from package.json.",
31
+ "type": "string"
40
32
  },
41
33
  "base": {
42
- "description": "Relative path from repository root to project root. Useful for monorepos.",
43
- "default": "",
44
- "type": "string"
34
+ "description": "Relative path from repository root to project root.",
35
+ "default": "",
36
+ "type": "string"
37
+ },
38
+ "branch": {
39
+ "description": "Git branch to release from.",
40
+ "type": "string"
45
41
  },
46
42
  "changelogPath": {
47
- "description": "Changelog file path, relative to project root.",
48
- "default": "CHANGELOG.md",
49
- "type": "string"
43
+ "description": "Changelog file path, relative to project root.",
44
+ "default": "CHANGELOG.md",
45
+ "type": "string"
50
46
  },
51
47
  "bumpStrategy": {
52
- "description": "\"auto\" (from commits) or \"manual\" (user-specified).",
53
- "default": "",
54
- "anyOf": [
55
- {
56
- "type": "string",
57
- "enum": ["auto", "manual"]
58
- },
59
- {
60
- "type": "string",
61
- "const": ""
62
- }
63
- ]
48
+ "description": "\"auto\" (from commits) or \"manual\" (user-specified).",
49
+ "default": "",
50
+ "anyOf": [
51
+ {
52
+ "type": "string",
53
+ "enum": ["auto", "manual"]
54
+ },
55
+ {
56
+ "type": "string",
57
+ "const": ""
58
+ }
59
+ ]
64
60
  },
65
61
  "releaseType": {
66
- "description": "The release type to bump.",
67
- "type": "string",
68
- "enum": ["major", "minor", "patch", "prerelease", "premajor", "preminor", "prepatch", "graduate"]
62
+ "description": "The release type to bump.",
63
+ "type": "string",
64
+ "enum": [
65
+ "major",
66
+ "minor",
67
+ "patch",
68
+ "prerelease",
69
+ "premajor",
70
+ "preminor",
71
+ "prepatch",
72
+ "graduate"
73
+ ]
69
74
  },
70
75
  "preReleaseId": {
71
- "description": "Pre-release ID (e.g., \"alpha\", \"beta\").",
72
- "default": "alpha",
73
- "type": "string"
76
+ "description": "Pre-release ID (e.g., \"alpha\", \"beta\").",
77
+ "type": "string"
74
78
  },
75
79
  "preReleaseBase": {
76
- "description": "Starting version for pre-releases.",
77
- "anyOf": [
78
- {
79
- "type": "number"
80
- },
81
- {
82
- "type": "string",
83
- "const": "0"
84
- },
85
- {
86
- "type": "string",
87
- "const": "1"
88
- }
89
- ]
80
+ "description": "Starting version for pre-releases.",
81
+ "anyOf": [
82
+ {
83
+ "type": "number"
84
+ },
85
+ {
86
+ "type": "string",
87
+ "const": "0"
88
+ },
89
+ {
90
+ "type": "string",
91
+ "const": "1"
92
+ }
93
+ ]
90
94
  },
91
95
  "releaseNotes": {
92
- "description": "Custom release notes for changelog.",
93
- "default": "",
94
- "type": "string"
96
+ "description": "Custom release notes for changelog.",
97
+ "default": "",
98
+ "type": "string"
95
99
  },
96
100
  "commitMessage": {
97
- "description": "Commit message template with placeholders.",
98
- "default": "chore(release): release {{name}}@{{version}}",
99
- "type": "string"
101
+ "description": "Commit message template with placeholders.",
102
+ "default": "chore(release): release {{name}}@{{version}}",
103
+ "type": "string"
100
104
  },
101
105
  "tagName": {
102
- "description": "Tag name template with placeholders.",
103
- "default": "{{name}}@{{version}}",
104
- "type": "string"
106
+ "description": "Tag name template with placeholders.",
107
+ "default": "{{name}}@{{version}}",
108
+ "type": "string"
105
109
  },
106
110
  "skipBump": {
107
- "description": "Skip version bump step.",
108
- "default": false,
109
- "type": "boolean"
111
+ "description": "Skip version bump step.",
112
+ "default": false,
113
+ "type": "boolean"
110
114
  },
111
115
  "skipChangelog": {
112
- "description": "Skip changelog generation step.",
113
- "default": false,
114
- "type": "boolean"
116
+ "description": "Skip changelog generation step.",
117
+ "default": false,
118
+ "type": "boolean"
115
119
  },
116
120
  "skipPush": {
117
- "description": "Skip push step.",
118
- "default": false,
119
- "type": "boolean"
121
+ "description": "Skip push step.",
122
+ "default": false,
123
+ "type": "boolean"
120
124
  },
121
125
  "skipGitHubRelease": {
122
- "description": "Skip GitHub release step.",
123
- "default": false,
124
- "type": "boolean"
126
+ "description": "Skip GitHub release step.",
127
+ "default": false,
128
+ "type": "boolean"
125
129
  },
126
130
  "skipGit": {
127
- "description": "Skip all git-related steps.",
128
- "default": false,
129
- "type": "boolean"
131
+ "description": "Skip all git-related steps.",
132
+ "default": false,
133
+ "type": "boolean"
130
134
  },
131
135
  "skipPreflightCheck": {
132
- "description": "Skip preflight checks.",
133
- "default": false,
134
- "type": "boolean"
136
+ "description": "Skip preflight checks.",
137
+ "default": false,
138
+ "type": "boolean"
135
139
  },
136
140
  "releaseTitle": {
137
- "description": "GitHub release title with placeholders.",
138
- "default": "{{name}}@{{version}}",
139
- "type": "string"
141
+ "description": "GitHub release title with placeholders.",
142
+ "default": "{{name}}@{{version}}",
143
+ "type": "string"
140
144
  },
141
145
  "releaseLatest": {
142
- "description": "Mark as latest release.",
143
- "default": true,
144
- "type": "boolean"
146
+ "description": "Mark as latest release.",
147
+ "default": true,
148
+ "type": "boolean"
145
149
  },
146
150
  "releasePreRelease": {
147
- "description": "Mark as pre-release.",
148
- "default": false,
149
- "type": "boolean"
151
+ "description": "Mark as pre-release.",
152
+ "default": false,
153
+ "type": "boolean"
150
154
  },
151
155
  "releaseDraft": {
152
- "description": "Release as draft version.",
153
- "default": false,
154
- "type": "boolean"
156
+ "description": "Release as draft version.",
157
+ "default": false,
158
+ "type": "boolean"
155
159
  }
160
+ }
156
161
  }
162
+ }
157
163
  }
@@ -0,0 +1,38 @@
1
+ import { t as logger } from "./main.js";
2
+ import { i as FireflyOkAsync } from "./result.constructors-C9M1MP3_.js";
3
+
4
+ //#region src/infrastructure/dry-run/index.ts
5
+ /**
6
+ * Wraps an async operation with dry-run awareness.
7
+ *
8
+ * When `dryRun` is enabled, logs the intended operation and returns
9
+ * a successful result without executing the actual operation.
10
+ *
11
+ * @template T - The return type of the operation
12
+ * @param options - Configuration including the dry-run flag
13
+ * @param message - Description of the operation (logged in dry-run mode)
14
+ * @param operation - The actual operation to execute when not in dry-run mode
15
+ * @returns The operation result, or a dry-run placeholder
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * // In a service method:
20
+ * write(path: string, content: string, options?: WriteOptions): FireflyAsyncResult<void> {
21
+ * return withDryRun(
22
+ * options,
23
+ * `Writing to ${path}`,
24
+ * () => wrapPromise(Bun.write(path, content).then(() => {}))
25
+ * );
26
+ * }
27
+ * ```
28
+ */
29
+ function withDryRun(options, message, operation, dryRunReturnValue) {
30
+ if (options?.dryRun) {
31
+ logger.verbose(`Dry run: ${message}`);
32
+ return FireflyOkAsync(dryRunReturnValue);
33
+ }
34
+ return operation();
35
+ }
36
+
37
+ //#endregion
38
+ export { withDryRun as t };
@@ -0,0 +1,57 @@
1
+ import { c as notFoundErrAsync } from "./result.constructors-C9M1MP3_.js";
2
+ import { n as wrapPromise } from "./result.utilities-B03Jkhlx.js";
3
+ import { t as withDryRun } from "./dry-run-BfYCtldz.js";
4
+
5
+ //#region src/services/implementations/filesystem.service.ts
6
+ /**
7
+ * Default implementation of the file system service.
8
+ */
9
+ var DefaultFileSystemService = class {
10
+ /**
11
+ * The workspace root directory used for resolving relative paths.
12
+ */
13
+ basePath;
14
+ /**
15
+ * Creates a new file system service.
16
+ */
17
+ constructor(basePath) {
18
+ this.basePath = basePath;
19
+ }
20
+ /**
21
+ * Resolves a file path to an absolute path.
22
+ *
23
+ * @param path - The file path to resolve.
24
+ * @returns The resolved absolute file path.
25
+ */
26
+ resolvePath(path) {
27
+ if (path.startsWith("/")) return path;
28
+ return `${this.basePath}/${path}`;
29
+ }
30
+ exists(path) {
31
+ const resolved = this.resolvePath(path);
32
+ return wrapPromise(Bun.file(resolved).exists());
33
+ }
34
+ read(path) {
35
+ const resolved = this.resolvePath(path);
36
+ const file = Bun.file(resolved);
37
+ return wrapPromise(file.exists()).andThen((fileExists) => {
38
+ if (!fileExists) return notFoundErrAsync({
39
+ message: `File not found: ${resolved}`,
40
+ source: "FileSystemService.read"
41
+ });
42
+ return wrapPromise(file.text());
43
+ });
44
+ }
45
+ write(path, content, options) {
46
+ return withDryRun(options, `Writing to ${this.resolvePath(path)}`, () => wrapPromise(Bun.write(this.resolvePath(path), content).then(() => {})));
47
+ }
48
+ };
49
+ /**
50
+ * Creates a file system service instance.
51
+ */
52
+ function createFileSystemService(basePath) {
53
+ return new DefaultFileSystemService(basePath);
54
+ }
55
+
56
+ //#endregion
57
+ export { createFileSystemService };