Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions documentation/architecture/openspec/specs/apply-mimeogram/spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# apply-mimeogram

## Purpose
Enables users to apply changes contained in a mimeogram to the local filesystem. This capability is essential for incorporating code or text generated by LLMs back into the project.

## Requirements

### Requirement: Input Source
The system SHALL accept mimeogram input from a file, standard input, or the system clipboard.

Priority: Critical

#### Scenario: File input
- **WHEN** user provides a file path as input
- **THEN** the mimeogram is read from that file

#### Scenario: Stdin input
- **WHEN** user pipes content to the command
- **THEN** the mimeogram is read from standard input

#### Scenario: Clipboard input
- **WHEN** user provides the `--from-clipboard` flag
- **THEN** the mimeogram is read from the system clipboard

### Requirement: Interactive Review
The system SHALL support an interactive review mode where users can approve, reject, or modify changes before they are applied.

Priority: High

#### Scenario: Partitive review (default on TTY)
- **WHEN** running in an interactive terminal
- **AND** review mode is not explicitly set to silent
- **THEN** the user is prompted for action on each part (Apply, Diff, Edit, Ignore, etc.)

### Requirement: Silent Application
The system SHALL support a silent mode to apply all changes without user interaction.

Priority: Medium

#### Scenario: Silent mode
- **WHEN** user provides the `--review-mode silent` flag (or runs non-interactively)
- **THEN** all parts are applied without prompting

### Requirement: Base Directory
The system SHALL allow users to specify a base directory for relative paths in the mimeogram.

Priority: Medium

#### Scenario: Base directory specified
- **WHEN** user provides `--base-directory /path/to/dir`
- **THEN** file paths in the mimeogram are resolved relative to that directory

### Requirement: Filesystem Protection
The system SHALL identify and protect sensitive files from being overwritten, requiring explicit user permission or a force flag.

Priority: Critical

#### Scenario: Protected file modification
- **WHEN** a mimeogram contains changes to a protected file (e.g., in `.config`)
- **THEN** the system flags the file as protected
- **AND** requires explicit confirmation or the `--disable-protections` flag to apply changes

### Requirement: Update Execution
The system SHALL apply the accepted changes to the filesystem.

Priority: Critical

#### Scenario: Apply changes
- **WHEN** a part is marked for application (via interactive choice or silent mode)
- **THEN** the file at the target path is updated with the content from the mimeogram
46 changes: 46 additions & 0 deletions documentation/architecture/openspec/specs/cli-interface/spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# cli-interface

## Purpose
Provides the general command-line interface framework for the application, including entry point, versioning, configuration management, and output formatting.

## Requirements

### Requirement: Entry Point
The system SHALL provide a main executable command that dispatches to subcommands.

Priority: Critical

#### Scenario: Subcommand dispatch
- **WHEN** user runs `mimeogram <subcommand>`
- **THEN** the appropriate subcommand handler is executed

### Requirement: Version Information
The system SHALL provide a command to display the current version of the application.

Priority: High

#### Scenario: Display version
- **WHEN** user runs `mimeogram version`
- **THEN** the package name and version are printed

### Requirement: Configuration Loading
The system SHALL load configuration from standard configuration file locations or a user-specified file.

Priority: Medium

#### Scenario: Load default config
- **WHEN** user runs the application without specifying a config file
- **THEN** configuration is loaded from the platform-specific default location (e.g., `~/.config/mimeogram/general.toml`)

#### Scenario: Load specific config
- **WHEN** user provides `--configfile <path>`
- **THEN** configuration is loaded from the specified file

### Requirement: Output Formatting
The system SHALL provide structured and styled output (e.g., using Rich) for better readability.

Priority: Low

#### Scenario: Rich output
- **WHEN** running in a terminal
- **THEN** output includes colors and formatting for emphasis and structure
113 changes: 113 additions & 0 deletions documentation/architecture/openspec/specs/create-mimeogram/spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# create-mimeogram

## Purpose
Enables users to bundle multiple files and directories into a single, structured document (a "mimeogram") suitable for sharing with Large Language Models (LLMs). This capability preserves file metadata and directory structure, facilitating code reviews and project sharing.

## Requirements

### Requirement: Source Acquisition
The system SHALL accept one or more source locations to include in the mimeogram.

Priority: Critical

#### Scenario: File inputs
- **WHEN** user provides a list of file paths
- **THEN** the content of each file is included in the mimeogram

#### Scenario: Directory inputs
- **WHEN** user provides a directory path
- **AND** recursion is enabled (or default behavior)
- **THEN** files within that directory are included

#### Scenario: URL inputs
- **WHEN** user provides a URL
- **THEN** the content at that URL is fetched and included

### Requirement: Recursion Control
The system SHALL allow users to control whether directory traversal is recursive.

Priority: Medium

#### Scenario: Recursive traversal
- **WHEN** user enables recursion (explicitly or by default)
- **THEN** subdirectories are traversed and their files included

#### Scenario: Non-recursive traversal
- **WHEN** user disables recursion
- **THEN** only files in the immediate directory are included

### Requirement: Exclusion Filtering
The system SHALL exclude files based on ignore rules (e.g., `.gitignore`) by default, but allow disabling this filtering.

Priority: High

#### Scenario: Default exclusion
- **WHEN** user creates a mimeogram in a git repository
- **THEN** files listed in `.gitignore` are excluded

#### Scenario: Disable exclusion
- **WHEN** user provides the `--no-ignores` flag
- **THEN** files listed in `.gitignore` are included

### Requirement: Clipboard Output
The system SHALL provide an option to copy the generated mimeogram directly to the system clipboard.

Priority: High

#### Scenario: Copy to clipboard
- **WHEN** user provides the `--clipboard` flag
- **THEN** the mimeogram is copied to the clipboard
- **AND** a success message is displayed

### Requirement: Token Counting
The system SHALL provide an option to count and display the number of tokens in the generated mimeogram.

Priority: Medium

#### Scenario: Count tokens
- **WHEN** user provides the `--count-tokens` flag
- **THEN** the total token count is calculated using the configured tokenizer
- **AND** the count is displayed to the user

### Requirement: Introductory Message
The system SHALL allow users to add an introductory message to the mimeogram, optionally launching an editor to capture it.

Priority: Low

#### Scenario: Edit message
- **WHEN** user provides the `--edit-message` flag
- **THEN** the system default editor is launched
- **AND** the user's saved text is included as a message in the mimeogram

### Requirement: Prompt Prepending
The system SHALL allow users to prepend standard mimeogram format instructions to the output.

Priority: Medium

#### Scenario: Prepend prompt
- **WHEN** user provides the `--prepend-prompt` flag
- **THEN** the standard mimeogram instructions are added to the beginning of the output

### Requirement: Strict Mode
The system SHALL allow users to control behavior when encountering invalid or inaccessible files.

Priority: Low

#### Scenario: Strict mode enabled
- **WHEN** user provides the `--fail-on-invalid` flag
- **AND** a source file is inaccessible
- **THEN** the process fails with an error

#### Scenario: Strict mode disabled (default)
- **WHEN** strict mode is not enabled
- **AND** a source file is inaccessible
- **THEN** the file is skipped and a warning is logged

### Requirement: Deterministic Output
The system SHALL allow users to generate reproducible mimeograms with deterministic boundary markers.

Priority: Low

#### Scenario: Deterministic boundary
- **WHEN** user provides the `--deterministic-boundary` flag
- **THEN** the MIME boundary is generated based on content hash
25 changes: 25 additions & 0 deletions documentation/architecture/openspec/specs/provide-prompt/spec.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# provide-prompt

## Purpose
Provides users with the standard prompt text used to instruct LLMs on the mimeogram format. This facilitates manual copy-pasting or integration into LLM project instructions.

## Requirements

### Requirement: Prompt Output
The system SHALL output the standard mimeogram prompt text.

Priority: High

#### Scenario: Output to stdout
- **WHEN** user executes the command
- **THEN** the prompt text is printed to standard output

### Requirement: Clipboard Copy
The system SHALL provide an option to copy the prompt text directly to the clipboard.

Priority: Medium

#### Scenario: Copy to clipboard
- **WHEN** user provides the `--to-clipboard` flag
- **THEN** the prompt text is copied to the system clipboard
- **AND** a success message is displayed