RuleStack

Configs

Stacks

Compare

Diff

RuleStack

Configs

Stacks

Compare

Diff

Read API

RuleStack

Configs

Stacks

Compare

Diff

Read API

Configs/mas-cli/mas/diff

Two files, one repository

mas-cli/mas ships 2 formats across 2 indexed files. The question worth asking is whether the second one says anything the first does not.

CompareAGENTS.md ↔ GEMINI.md
A · AGENTS.md · 1082 wordsB · GEMINI.md · 397 words
What each file covers, counted
DimensionSharedOnly in AOnly in BOverlap
Sections213147%
Commands000—
Section tags51263%

What each file covers

Sections

2 shared · 13 only in A · 14 only in B
  • − Project Guidelines
  • − Purpose & Scope
  • − Minimum Versions
  • − Quick Entry Points
  • − Content Formatting
  • − Refactoring Rules
  • − Scripting
  • − Swift
  • − Apple Private Frameworks
  • − Swift Source Folder Hierarchy
  • − Command Implementation Patterns
  • − Style Essentials
  • − Code Preference Hierarchies
  • + Gemini Guidelines for `mas`
  • + Project Overview
  • + Technical Stack
  • + Development Workflows
  • + Bootstrap
  • + Build
  • + Lint & Format
  • + Test
  • + Engineering Standards
  • + Content Guidelines
  • + Markdown Guidelines
  • + YAML Guidelines
  • + Zsh Scripting
  • + Swift Development
  •   Git Workflow
  •   Testing Requirements

Commands

neither file has any

Section tags

5 shared · 1 only in A · 2 only in B
  • − do-not
  • + build
  • + architecture
  •   test
  •   lint-format
  •   code-style
  •   git-pr
  •   agent-behaviour

Line diff

+76 added−259 removed31 unchanged10.7% identical
mas-cli/mas · AGENTS.md
@@ −1 @@
1# Project Guidelines
2 
3## Purpose & Scope
 
4 
5This file is the canonical source of project conventions for humans & agents.
6Read it before making repository changes.
7 
8## Minimum Versions
 
 
 
 
 
9 
10- **Swift:** 6.3
11- **Xcode:** 26.4
12- **macOS:** 13
13 
14## Quick Entry Points
 
 
 
 
15 
16- `Scripts/bootstrap`
17- `Scripts/format`
18- `Scripts/lint -AP` (quick) / `Scripts/lint` (includes unused code checks)
19- `Scripts/build` (debug) / `Scripts/build '' -c release` (release)
20- `Scripts/test`
21- `Scripts/package`
22 
23## Git Workflow
24 
25- `main` is the trunk
26- Branch topics from `main`
27- Before committing (to preserve tokens, agents should skip steps 2 & 3):
28 1. Add or edit tests for non-trivial changes
29 2. Repeatedly run `Scripts/format` until no modifications are made
30 3. Repeatedly run `Scripts/lint` & fix all violations until no violations are
31 reported
32- **Commit messages:** Follow [commit message conventions](
33 https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
34 )
35- Tag releases as `vX.Y.Z`
36 
37## Content Formatting
38 
39- **Newlines:** UNIX (i.e. `\n`)
40- **Indentation:** Tabs (width: 2)
41- **Max line length:** 120 characters (tabs count as 2 characters)
42- **Unnecessary trailing whitespace:** Remove
43- **File ends:** Single newline
44 
45## Refactoring Rules
46 
47Unless absolutely necessary for functionality or fixes, or unless violations of
48standards are discovered, do not:
 
49 
50- reformat
51- rename
52- reorder
53- respace
54- reword
55- remove comments
56- refactor if it worsens the caller interface
57 
58Refactoring should:
 
 
59 
60- Keep clean abstractions
61- Inline a utility iff it is single-use
62- Replace a utility iff the new version is more correct, performant, and/or
63 simpler than the existing version, in descending order of priority
64 
65## Scripting
66 
67- Use zsh for scripts (except for shell-specific completion scripts)
68- Zsh scripts must be compatible with all zsh versions starting with the version
69 ([currently 5.9](https://opensource.apple.com/releases/)) bundled with the
70 newest version ([currently 13.5.x](https://opensource.apple.com/releases/))
71 of the oldest macOS major version supported by mas
72 ([currently 13](Package.swift))
73- Use `#!/bin/zsh` shebang (with `-Ndefgku` options, unless any changes to the
74 options are absolutely necessary)
75- Run `. "${0:A:h}/_setup_script"` at the start of all development scripts
76- Prefer concision over verbosity
77- If performance is at least almost equivalent or better, prefer in descending
78 order:
79 - zsh expansions
80 - zsh globs
81 - zsh builtins
82 - zsh loops
83 - external commands
84- Make variables local & readonly when possible
85- Use:
86 - `cp -c` instead of `cp`
87 - `trash` instead of `rm`
88 
89## Swift
 
 
 
 
 
90 
91mas is a SwiftPM project that uses Swift Argument Parser to interact with the
92command-line.
93 
94### Apple Private Frameworks
 
 
 
 
95 
96The `PrivateFrameworks` SwiftPM target exposes the following Apple private
97frameworks (via Objective-C headers extracted from the DSC) to deploy App Store
98apps:
99 
100- **CommerceKit:** Controllers
101- **StoreFoundation:** Models
 
102 
103Use private frameworks only when public APIs are insufficient.
104 
105Newer Apple private frameworks (e.g., AppStoreDaemon & AppleMediaServices) seem
106to supersede the currently used ones, but the newer ones seem usable only by
107code with Apple-exclusive entitlements.
 
108 
109### Swift Source Folder Hierarchy
110 
111Swift source is organized in subfolders of `Sources/mas`:
 
 
 
 
 
112 
113- **Commands:** CLI implementation
114- **Models:** Data types & suppliers
115- **Utilities:** Utilities
116 
117### Command Implementation Patterns
 
 
 
 
 
118 
119Commands follow a consistent structure:
120 
121- Commands are nested structs within the `MAS` main command
122- Use `@OptionGroup` to compose reusable argument sets from dedicated types
123 that conform to `ParsableArguments`
124- Implement `func run() async { … }` as the main command entry point
125- Use the static `MAS.printer` for all output to ensure consistent formatting
126- Call methods on `AppStoreAction` enum cases (accessible via the `AppStore`
127 typealias) to execute business logic, e.g., `await AppStore.install.apps(…)`
128 
129### Style Essentials
130 
131- Name most function parameters
132- Capitalize acronym & initialism characters consistently (e.g., `HTTPRequest`,
133 not `HttpRequest`)
134- Shadow variables if the respective original will no longer be used
135- Strongify weak references instead of evaluating them multiple times
136 
137### Code Preference Hierarchies
138 
139Each subsection contains code preferences in descending order.
140 
141Within this section & all subsections, `X` is a placeholder for any type name.
142 
143#### Naming
144 
1451. Standardized name
1462. Concise name
1473. Verbose name
148 
149#### Concision/Verbosity
150 
1511. Concise code, e.g.:
152 - Optional binding shorthand (e.g., `if let x { … }`, not
153 `if let x = x{ … }`)
1542. Verbose code
155 
156#### Architecture
157 
1581. Composition
1592. Protocol conformance
1603. Class inheritance
161 
162#### Typing
163 
1641. Inferred type, e.g.:
165 - `var a = [X]()`
166 - `var o = X?.none`
167 - `var c: X { .init() }`
168 - `f(array: .init())`
169 - `f(dictionary: .init())`
1702. Cast type, e.g.:
171 - `var a = [] as [X]`
172 - `var o = nil as X?`
1733. Explicit type, e.g.:
174 - `var a: [X] = .init()`
175 - `var o: X? = nil`
176 - `var c: X { X() }`
177 - `f(array: [])`
178 - `f(dictionary: [:])`
179 
180#### Functional
181 
1821. Functional
1832. Non-functional
184 
185#### Value Inlining/Binding
186 
1871. Inlined single-use value
1882. `let` multiple-use value
1893. `var` multiple-use value
190 
191#### Code Inlining/Reuse
192 
1931. Inlined single-use code (unless inlined code is much more complex)
1942. Computed property
1953. Function
196 
197#### Optional Handling
198 
1991. Nil-coalescing operator (`??`)
2002. Ternary operator
2013. `Optional.map(_:)` / `Optional.flatMap(_:)`
2024. Single `guard`
2035. `if` / `else` (no `else if`)
2046. `switch`
2057. Multiple `guard`
2068. `if` / `else if`… / `else`
2079. `preconditionFailure(_:file:line:)`
20810. Forced unwrapping (`!` suffix)
20911. `fatalError(_:file:line:)`
210 
211#### Throwing
212 
2131. Typed throws (`throws(ErrorType)`)
2142. Untyped rethrows (`rethrows`)
2153. Untyped throws (`throws`)
216 
217#### Code Reuse
218 
2191. Framework/library call
2202. Custom code
221 
222#### Constants
223 
2241. Global `let`
2252. `enum` `static let`
2263. `struct` `static let`
2274. `class` `static let`
228 
229#### Preferred Types
230 
2311. Unaliased infrequent tuple/closure
2322. Type-aliased frequent tuple/closure
2333. `enum`
2344. `struct`
2355. `actor`
2366. `final class`
2377. `class`
238 
239#### Type Syntax
240 
2411. Concision:
242 - Generics: `<T: X>`
243 - Optional: `X?`
244 - Collection: `[X]`
245 - Dictionary: `[X:X]`
2462. Verbosity:
247 - Generics: `where T: X`
248 - Optional: `Optional<X>`
249 - Collection: `Array<X>`
250 - Dictionary: `Dictionary<X, X>`
251 
252#### Void Types
253 
2541. `()` for void parameter type
2552. `Void` for void return type
256 
257#### Closure Syntax
258 
2591. Trailing closure
2602. Inline closure
261 
262#### Closure Arguments
263 
2641. Shorthand argument names (e.g., `$0`) iff one-line closure
2652. Explicit argument names for multi-line closure
266 
267#### Functional Arguments
268 
2691. KeyPath
2702. Function reference
2713. Closure
272 
273#### Strict Memory Safety
274 
2751. Memory-safe code (i.e. not `unsafe`)
2762. `unsafe` code iff a memory-safe alternative:
277 - Is not available from frameworks/libraries
278 - Is too difficult to implement properly & performantly
279 
280### Testing Requirements
281 
282- Add tests for all non-trivial changes
283- Implement in [Swift Testing](https://github.com/swiftlang/swift-testing)
284- Derive test file paths from source file paths:
285 - replace the `Sources/mas` source path folder prefix with `Tests/MASTests`
286 - prepend `MASTests+` to the source file name
287 - e.g., `Sources/mas/Commands/X.swift` →
288 `Tests/MASTests/Commands/MASTests+X.swift`
289- Use force unwrapping in tests where appropriate
290 
mas-cli/mas · GEMINI.md
@@ +1 @@
1# Gemini Guidelines for `mas`
2 
3You are an expert Swift & Zsh developer assisting with the maintenance &
4development of `mas`, a command-line interface for the Mac App Store.
5 
6## Project Overview
 
7 
8- **Name:** `mas`
9- **Description:** A CLI for the Mac App Store, designed for scripting &
10 automation.
11- **Language:** Swift 6.3 (using Swift Argument Parser)
12- **Target OS:** macOS 13+
13- **Project Type:** SwiftPM project
14 
15## Technical Stack
 
 
16 
17- **Swift:** 6.3+ (Check [.swift-version](.swift-version))
18- **Xcode:** 26.4+ (Check [.xcode-version](.xcode-version))
19- **macOS:** 13+ (Check [Package.swift](Package.swift))
20- **Private Frameworks:** Uses `CommerceKit` & `StoreFoundation` for App Store
21 integration only where public APIs are insufficient.
22 
23## Development Workflows
 
 
 
 
 
24 
25### Bootstrap
26 
27```shell
28Scripts/bootstrap
29```
 
 
 
 
 
 
 
 
30 
31### Build
32 
33- Debug: `Scripts/build`
34- Release: `Scripts/build '' -c release`
 
 
 
35 
36### Lint & Format
37 
38- Quick Lint: `Scripts/lint -AP`
39- Full Lint: `Scripts/lint`
40- Format: `Scripts/format` (Run repeatedly until no changes occur)
41 
42### Test
 
 
 
 
 
 
43 
44```shell
45Scripts/test
46```
47 
48## Engineering Standards
 
 
 
49 
50Refer to [AGENTS.md](AGENTS.md) for comprehensive guidelines. Key highlights:
51 
52### Content Guidelines
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53 
54- **Newlines:** UNIX (LF)
55- **Indentation:** Tabs (width: 2) for Swift/Zsh; Spaces (2) for YAML; Spaces
56 (1) for Markdown.
57- **Max line length:** 120 characters (80 for Markdown).
58- **Preservation:** Do not reformat, rename, or reorder code unless necessary
59 for functionality.
60 
61### Markdown Guidelines
 
62 
63- **Style:** GitHub-Flavored Markdown (GFM), ATX headings, backtick-fenced code
64 blocks with language identifier, underscore emphasis, asterisk strong & hyphen
65 bullets.
66- **HTML:** Limited to elements supported by GFM that don't have an equivalent
67 in GFM for the use case.
68 
69### YAML Guidelines
 
 
70 
71- **Style:** 2-space indentation, unix newlines, quoted strings only when
72 necessary, single quotes for strings.
73- **Rules:** Forbid non-empty braces, require document start (`---`).
74 
75### Zsh Scripting
76 
77- **Shebang:** `#!/bin/zsh -Ndefgku`
78- **Setup:** Start scripts with `. "${0:A:h}/_setup_script"`
79- **Preference:** Use zsh builtins over external commands.
80- **Commands:** Use `cp -c` & `trash` (not `rm`).
81 
82### Swift Development
83 
84- **Structure:** Organized by `Commands/`, `Models/`, `Utilities/`.
85- **Force Unwrapping:** Avoid in `Sources/mas/`.
86- **Naming:** Capitalize acronyms consistently (e.g., `ADAM`, `API`, `JSON`).
87- **Organization:** Group computed properties below stored properties.
88- **Error Handling:** Prefer typed throws (`throws(ErrorType)`),
89 then `rethrows`, then untyped `throws`.
90 
91### Git Workflow
 
 
92 
93- **Trunk:** `main`
94- **Commits:** Follow [conventional commit style](
95 https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
96 ).
97- **Pre-commit:** Always run `Scripts/format` & `Scripts/lint` before
98 committing.
99 
100## Testing Requirements
101 
102- **Framework:** [Swift Testing](https://github.com/swiftlang/swift-testing).
103- **Location:** `Tests/MASTests/`
104- **Naming Convention:** `Sources/mas/Path/To/File.swift` ->
105 `Tests/MASTests/Path/To/MASTests+File.swift`.
106- **Assertions:** Use force unwrapping (`!`) in tests if appropriate.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107 
@@ −1 +1 @@
1−# Project Guidelines
1+# Gemini Guidelines for `mas`
22  
3−## Purpose & Scope
3+You are an expert Swift & Zsh developer assisting with the maintenance &
4+development of `mas`, a command-line interface for the Mac App Store.
45  
5−This file is the canonical source of project conventions for humans & agents.
6−Read it before making repository changes.
6+## Project Overview
77  
8−## Minimum Versions
8+- **Name:** `mas`
9+- **Description:** A CLI for the Mac App Store, designed for scripting &
10+ automation.
11+- **Language:** Swift 6.3 (using Swift Argument Parser)
12+- **Target OS:** macOS 13+
13+- **Project Type:** SwiftPM project
914  
10−- **Swift:** 6.3
11−- **Xcode:** 26.4
12−- **macOS:** 13
15+## Technical Stack
1316  
14−## Quick Entry Points
17+- **Swift:** 6.3+ (Check [.swift-version](.swift-version))
18+- **Xcode:** 26.4+ (Check [.xcode-version](.xcode-version))
19+- **macOS:** 13+ (Check [Package.swift](Package.swift))
20+- **Private Frameworks:** Uses `CommerceKit` & `StoreFoundation` for App Store
21+ integration only where public APIs are insufficient.
1522  
16−- `Scripts/bootstrap`
17−- `Scripts/format`
18−- `Scripts/lint -AP` (quick) / `Scripts/lint` (includes unused code checks)
19−- `Scripts/build` (debug) / `Scripts/build '' -c release` (release)
20−- `Scripts/test`
21−- `Scripts/package`
23+## Development Workflows
2224  
23−## Git Workflow
25+### Bootstrap
2426  
25−- `main` is the trunk
26−- Branch topics from `main`
27−- Before committing (to preserve tokens, agents should skip steps 2 & 3):
28− 1. Add or edit tests for non-trivial changes
29− 2. Repeatedly run `Scripts/format` until no modifications are made
30− 3. Repeatedly run `Scripts/lint` & fix all violations until no violations are
31− reported
32−- **Commit messages:** Follow [commit message conventions](
33− https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
34− )
35−- Tag releases as `vX.Y.Z`
27+```shell
28+Scripts/bootstrap
29+```
3630  
37−## Content Formatting
31+### Build
3832  
39−- **Newlines:** UNIX (i.e. `\n`)
40−- **Indentation:** Tabs (width: 2)
41−- **Max line length:** 120 characters (tabs count as 2 characters)
42−- **Unnecessary trailing whitespace:** Remove
43−- **File ends:** Single newline
33+- Debug: `Scripts/build`
34+- Release: `Scripts/build '' -c release`
4435  
45−## Refactoring Rules
36+### Lint & Format
4637  
47−Unless absolutely necessary for functionality or fixes, or unless violations of
48−standards are discovered, do not:
38+- Quick Lint: `Scripts/lint -AP`
39+- Full Lint: `Scripts/lint`
40+- Format: `Scripts/format` (Run repeatedly until no changes occur)
4941  
50−- reformat
51−- rename
52−- reorder
53−- respace
54−- reword
55−- remove comments
56−- refactor if it worsens the caller interface
42+### Test
5743  
58−Refactoring should:
44+```shell
45+Scripts/test
46+```
5947  
60−- Keep clean abstractions
61−- Inline a utility iff it is single-use
62−- Replace a utility iff the new version is more correct, performant, and/or
63− simpler than the existing version, in descending order of priority
48+## Engineering Standards
6449  
65−## Scripting
50+Refer to [AGENTS.md](AGENTS.md) for comprehensive guidelines. Key highlights:
6651  
67−- Use zsh for scripts (except for shell-specific completion scripts)
68−- Zsh scripts must be compatible with all zsh versions starting with the version
69− ([currently 5.9](https://opensource.apple.com/releases/)) bundled with the
70− newest version ([currently 13.5.x](https://opensource.apple.com/releases/))
71− of the oldest macOS major version supported by mas
72− ([currently 13](Package.swift))
73−- Use `#!/bin/zsh` shebang (with `-Ndefgku` options, unless any changes to the
74− options are absolutely necessary)
75−- Run `. "${0:A:h}/_setup_script"` at the start of all development scripts
76−- Prefer concision over verbosity
77−- If performance is at least almost equivalent or better, prefer in descending
78− order:
79− - zsh expansions
80− - zsh globs
81− - zsh builtins
82− - zsh loops
83− - external commands
84−- Make variables local & readonly when possible
85−- Use:
86− - `cp -c` instead of `cp`
87− - `trash` instead of `rm`
52+### Content Guidelines
8853  
89−## Swift
54+- **Newlines:** UNIX (LF)
55+- **Indentation:** Tabs (width: 2) for Swift/Zsh; Spaces (2) for YAML; Spaces
56+ (1) for Markdown.
57+- **Max line length:** 120 characters (80 for Markdown).
58+- **Preservation:** Do not reformat, rename, or reorder code unless necessary
59+ for functionality.
9060  
91−mas is a SwiftPM project that uses Swift Argument Parser to interact with the
92−command-line.
61+### Markdown Guidelines
9362  
94−### Apple Private Frameworks
63+- **Style:** GitHub-Flavored Markdown (GFM), ATX headings, backtick-fenced code
64+ blocks with language identifier, underscore emphasis, asterisk strong & hyphen
65+ bullets.
66+- **HTML:** Limited to elements supported by GFM that don't have an equivalent
67+ in GFM for the use case.
9568  
96−The `PrivateFrameworks` SwiftPM target exposes the following Apple private
97−frameworks (via Objective-C headers extracted from the DSC) to deploy App Store
98−apps:
69+### YAML Guidelines
9970  
100−- **CommerceKit:** Controllers
101−- **StoreFoundation:** Models
71+- **Style:** 2-space indentation, unix newlines, quoted strings only when
72+ necessary, single quotes for strings.
73+- **Rules:** Forbid non-empty braces, require document start (`---`).
10274  
103−Use private frameworks only when public APIs are insufficient.
75+### Zsh Scripting
10476  
105−Newer Apple private frameworks (e.g., AppStoreDaemon & AppleMediaServices) seem
106−to supersede the currently used ones, but the newer ones seem usable only by
107−code with Apple-exclusive entitlements.
77+- **Shebang:** `#!/bin/zsh -Ndefgku`
78+- **Setup:** Start scripts with `. "${0:A:h}/_setup_script"`
79+- **Preference:** Use zsh builtins over external commands.
80+- **Commands:** Use `cp -c` & `trash` (not `rm`).
10881  
109−### Swift Source Folder Hierarchy
82+### Swift Development
11083  
111−Swift source is organized in subfolders of `Sources/mas`:
84+- **Structure:** Organized by `Commands/`, `Models/`, `Utilities/`.
85+- **Force Unwrapping:** Avoid in `Sources/mas/`.
86+- **Naming:** Capitalize acronyms consistently (e.g., `ADAM`, `API`, `JSON`).
87+- **Organization:** Group computed properties below stored properties.
88+- **Error Handling:** Prefer typed throws (`throws(ErrorType)`),
89+ then `rethrows`, then untyped `throws`.
11290  
113−- **Commands:** CLI implementation
114−- **Models:** Data types & suppliers
115−- **Utilities:** Utilities
91+### Git Workflow
11692  
117−### Command Implementation Patterns
93+- **Trunk:** `main`
94+- **Commits:** Follow [conventional commit style](
95+ https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
96+ ).
97+- **Pre-commit:** Always run `Scripts/format` & `Scripts/lint` before
98+ committing.
11899  
119−Commands follow a consistent structure:
100+## Testing Requirements
120101  
121−- Commands are nested structs within the `MAS` main command
122−- Use `@OptionGroup` to compose reusable argument sets from dedicated types
123− that conform to `ParsableArguments`
124−- Implement `func run() async { … }` as the main command entry point
125−- Use the static `MAS.printer` for all output to ensure consistent formatting
126−- Call methods on `AppStoreAction` enum cases (accessible via the `AppStore`
127− typealias) to execute business logic, e.g., `await AppStore.install.apps(…)`
128− 
129−### Style Essentials
130− 
131−- Name most function parameters
132−- Capitalize acronym & initialism characters consistently (e.g., `HTTPRequest`,
133− not `HttpRequest`)
134−- Shadow variables if the respective original will no longer be used
135−- Strongify weak references instead of evaluating them multiple times
136− 
137−### Code Preference Hierarchies
138− 
139−Each subsection contains code preferences in descending order.
140− 
141−Within this section & all subsections, `X` is a placeholder for any type name.
142− 
143−#### Naming
144− 
145−1. Standardized name
146−2. Concise name
147−3. Verbose name
148− 
149−#### Concision/Verbosity
150− 
151−1. Concise code, e.g.:
152− - Optional binding shorthand (e.g., `if let x { … }`, not
153− `if let x = x{ … }`)
154−2. Verbose code
155− 
156−#### Architecture
157− 
158−1. Composition
159−2. Protocol conformance
160−3. Class inheritance
161− 
162−#### Typing
163− 
164−1. Inferred type, e.g.:
165− - `var a = [X]()`
166− - `var o = X?.none`
167− - `var c: X { .init() }`
168− - `f(array: .init())`
169− - `f(dictionary: .init())`
170−2. Cast type, e.g.:
171− - `var a = [] as [X]`
172− - `var o = nil as X?`
173−3. Explicit type, e.g.:
174− - `var a: [X] = .init()`
175− - `var o: X? = nil`
176− - `var c: X { X() }`
177− - `f(array: [])`
178− - `f(dictionary: [:])`
179− 
180−#### Functional
181− 
182−1. Functional
183−2. Non-functional
184− 
185−#### Value Inlining/Binding
186− 
187−1. Inlined single-use value
188−2. `let` multiple-use value
189−3. `var` multiple-use value
190− 
191−#### Code Inlining/Reuse
192− 
193−1. Inlined single-use code (unless inlined code is much more complex)
194−2. Computed property
195−3. Function
196− 
197−#### Optional Handling
198− 
199−1. Nil-coalescing operator (`??`)
200−2. Ternary operator
201−3. `Optional.map(_:)` / `Optional.flatMap(_:)`
202−4. Single `guard`
203−5. `if` / `else` (no `else if`)
204−6. `switch`
205−7. Multiple `guard`
206−8. `if` / `else if`… / `else`
207−9. `preconditionFailure(_:file:line:)`
208−10. Forced unwrapping (`!` suffix)
209−11. `fatalError(_:file:line:)`
210− 
211−#### Throwing
212− 
213−1. Typed throws (`throws(ErrorType)`)
214−2. Untyped rethrows (`rethrows`)
215−3. Untyped throws (`throws`)
216− 
217−#### Code Reuse
218− 
219−1. Framework/library call
220−2. Custom code
221− 
222−#### Constants
223− 
224−1. Global `let`
225−2. `enum` `static let`
226−3. `struct` `static let`
227−4. `class` `static let`
228− 
229−#### Preferred Types
230− 
231−1. Unaliased infrequent tuple/closure
232−2. Type-aliased frequent tuple/closure
233−3. `enum`
234−4. `struct`
235−5. `actor`
236−6. `final class`
237−7. `class`
238− 
239−#### Type Syntax
240− 
241−1. Concision:
242− - Generics: `<T: X>`
243− - Optional: `X?`
244− - Collection: `[X]`
245− - Dictionary: `[X:X]`
246−2. Verbosity:
247− - Generics: `where T: X`
248− - Optional: `Optional<X>`
249− - Collection: `Array<X>`
250− - Dictionary: `Dictionary<X, X>`
251− 
252−#### Void Types
253− 
254−1. `()` for void parameter type
255−2. `Void` for void return type
256− 
257−#### Closure Syntax
258− 
259−1. Trailing closure
260−2. Inline closure
261− 
262−#### Closure Arguments
263− 
264−1. Shorthand argument names (e.g., `$0`) iff one-line closure
265−2. Explicit argument names for multi-line closure
266− 
267−#### Functional Arguments
268− 
269−1. KeyPath
270−2. Function reference
271−3. Closure
272− 
273−#### Strict Memory Safety
274− 
275−1. Memory-safe code (i.e. not `unsafe`)
276−2. `unsafe` code iff a memory-safe alternative:
277− - Is not available from frameworks/libraries
278− - Is too difficult to implement properly & performantly
279− 
280−### Testing Requirements
281− 
282−- Add tests for all non-trivial changes
283−- Implement in [Swift Testing](https://github.com/swiftlang/swift-testing)
284−- Derive test file paths from source file paths:
285− - replace the `Sources/mas` source path folder prefix with `Tests/MASTests`
286− - prepend `MASTests+` to the source file name
287− - e.g., `Sources/mas/Commands/X.swift` →
288− `Tests/MASTests/Commands/MASTests+X.swift`
289−- Use force unwrapping in tests where appropriate
102+- **Framework:** [Swift Testing](https://github.com/swiftlang/swift-testing).
103+- **Location:** `Tests/MASTests/`
104+- **Naming Convention:** `Sources/mas/Path/To/File.swift` ->
105+ `Tests/MASTests/Path/To/MASTests+File.swift`.
106+- **Assertions:** Use force unwrapping (`!`) in tests if appropriate.
290107  
RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack

RuleStack

Built by

Kynth Studio

Directory

Configs
Stacks
Compare formats
Diff two configs
Best AGENTS.md examples

Formats

AGENTS.md
CLAUDE.md
Cursor rules
Copilot instructions

Reference

Read API
Corpus health
Privacy Policy
Terms

RuleStack