Skip to content
Merged
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
3 changes: 2 additions & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ The architectural decisions and basis for the project in that document are only
- The project is meant to be used by developers and should be easy to use, with a focus on developer experience.
- The philosophy when architecting and implementing the project is to prime speed and simplicity over complexity. Do NOT over-engineer, but rather build a solid foundation that can be iterated on.
- APM is an active OSS project under the `microsoft` org with a growing community (250+ stars, external contributors). Breaking changes should be communicated clearly (CHANGELOG.md), but we still favor shipping fast over lengthy deprecation cycles.
- The goal is to deliver a solid and scalable architecture but simple starting implementation. Not building something complex from the start and then having to simplify it later. Remember we are delivering a new tool to the developer community and we will need to rapidly adapt to what's really useful, evolving standards, etc.
- The goal is to deliver a solid and scalable architecture but simple starting implementation. Not building something complex from the start and then having to simplify it later. Remember we are delivering a new tool to the developer community and we will need to rapidly adapt to what's really useful, evolving standards, etc.
- **Cross-platform encoding rule**: All source code and CLI output must stay within printable ASCII (U+0020–U+007E). Do NOT use emojis, Unicode symbols, box-drawing characters, em dashes, or any character outside the ASCII range in source files or CLI output strings. Use bracket notation for status symbols: `[+]` success, `[!]` warning, `[x]` error, `[i]` info, `[*]` action, `[>]` running. This is required to prevent `charmap` codec errors on Windows cp1252 terminals.
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The added encoding rule includes a non-ASCII en dash in U+0020–U+007E. Since the rule requires printable ASCII only, consider changing this to U+0020-U+007E to keep the instructions themselves ASCII-safe.

Suggested change
- **Cross-platform encoding rule**: All source code and CLI output must stay within printable ASCII (U+0020U+007E). Do NOT use emojis, Unicode symbols, box-drawing characters, em dashes, or any character outside the ASCII range in source files or CLI output strings. Use bracket notation for status symbols: `[+]` success, `[!]` warning, `[x]` error, `[i]` info, `[*]` action, `[>]` running. This is required to prevent `charmap` codec errors on Windows cp1252 terminals.
- **Cross-platform encoding rule**: All source code and CLI output must stay within printable ASCII (U+0020-U+007E). Do NOT use emojis, Unicode symbols, box-drawing characters, em dashes, or any character outside the ASCII range in source files or CLI output strings. Use bracket notation for status symbols: `[+]` success, `[!]` warning, `[x]` error, `[i]` info, `[*]` action, `[>]` running. This is required to prevent `charmap` codec errors on Windows cp1252 terminals.

Copilot uses AI. Check for mistakes.
61 changes: 29 additions & 32 deletions .github/instructions/cli.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,20 @@ description: "CLI Design Guidelines for visual output, styling, and user experie
- Wrap Rich imports in try/catch with colorama fallbacks

### Command Help Text
- **ALWAYS** include contextual emojis in command help strings
- Format: `help="🚀 Initialize a new APM project"`
- Use semantic emojis that match the command purpose
- Keep command help strings plain ASCII — no emojis
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line uses an em dash (). Since these instruction files are in-scope for the ASCII-only rule, consider replacing it with an ASCII hyphen (-) to keep the guidance self-consistent and avoid reintroducing non-ASCII punctuation.

Suggested change
- Keep command help strings plain ASCII no emojis
- Keep command help strings plain ASCII - no emojis

Copilot uses AI. Check for mistakes.
- Format: `help="Initialize a new APM project"`

### Status Symbols & Feedback
- Use `STATUS_SYMBOLS` dict for consistent iconography:
- `✨` success/completion
- `🚀` running/execution
- `⚙️` configuration/setup
- `💡` information/tips
- `📋` lists/display
- `👀` preview/inspection
- `🤖` AI/models/runtime
- `📊` status/metrics
- `⚠️` warnings
- `❌` errors
- `✅` installed/confirmed
- Use `STATUS_SYMBOLS` dict for consistent ASCII bracket notation:
- `[+]` success / confirmed
- `[>]` running / execution / progress
- `[*]` action / configuration / processing
- `[i]` information / tips
- `[#]` lists / metrics
- `[!]` warnings
- `[x]` errors
- Use helper functions: `_rich_success()`, `_rich_error()`, `_rich_info()`, `_rich_warning()`
- Pass the appropriate key from `STATUS_SYMBOLS` via the `symbol=` parameter (e.g. `symbol="check"`, `symbol="warning"`)
Comment on lines +21 to +30
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The symbol semantics described here don't fully match the current STATUS_SYMBOLS mapping (e.g. STATUS_SYMBOLS['success'] and ['sparkles'] map to [*] in src/apm_cli/utils/console.py, but this section frames [*] as "action / configuration / processing" while [+] is "success"). To avoid confusing contributors (and leading to inconsistent output), consider aligning this table with the actual mapping or explicitly standardizing which keys should be used for success vs. action going forward.

Suggested change
- Use `STATUS_SYMBOLS` dict for consistent ASCII bracket notation:
- `[+]` success / confirmed
- `[>]` running / execution / progress
- `[*]` action / configuration / processing
- `[i]` information / tips
- `[#]` lists / metrics
- `[!]` warnings
- `[x]` errors
- Use helper functions: `_rich_success()`, `_rich_error()`, `_rich_info()`, `_rich_warning()`
- Pass the appropriate key from `STATUS_SYMBOLS` via the `symbol=` parameter (e.g. `symbol="check"`, `symbol="warning"`)
- Use `STATUS_SYMBOLS` dict for consistent ASCII bracket notation.
- Always pass **semantic keys** (not raw symbols) to `STATUS_SYMBOLS`.
- Recommended keys and meanings:
- `success`: completed / confirmed operations (currently renders as `[*]`)
- `sparkles`: highlight / "nice" output (alias of `success`)
- `action`: action / configuration / processing
- `running`: running / execution / progress
- `info`: information / tips
- `list`: lists / metrics
- `warning`: warnings
- `error`: errors
- Use helper functions: `_rich_success()`, `_rich_error()`, `_rich_info()`, `_rich_warning()`
- Pass the appropriate key from `STATUS_SYMBOLS` via the `symbol=` parameter (e.g. `symbol="success"`, `symbol="warning"`)

Copilot uses AI. Check for mistakes.

### Structured Output
- **Tables**: Use Rich tables for structured data (scripts, models, config, runtimes)
Expand All @@ -58,23 +54,23 @@ description: "CLI Design Guidelines for visual output, styling, and user experie

### Color Scheme
- Primary: cyan for titles and highlights
- Success: green with symbol
- Warning: yellow with ⚠️ symbol
- Error: red with symbol
- Info: blue with 💡 symbol
- Success: green with `[+]` symbol
- Warning: yellow with `[!]` symbol
- Error: red with `[x]` symbol
- Info: blue with `[i]` symbol
- Muted: dim white for secondary text

### Table Design
- Include meaningful titles with emojis
- Include meaningful titles (plain ASCII, no emojis)
- Use semantic column styling (bold for names, muted for details)
- Keep tables clean with appropriate padding
- Show status with symbols in dedicated columns
- Show status with bracket symbols in dedicated columns

## Implementation Patterns

### Command Structure
```python
@cli.command(help="🚀 Action description")
@cli.command(help="Action description")
@click.option(...)
def command_name(...):
"""Detailed docstring."""
Expand All @@ -83,16 +79,16 @@ def command_name(...):

# Main logic here

_rich_success("Operation complete!", symbol="sparkles")
_rich_success("Operation complete!", symbol="check")
except Exception as e:
_rich_error(f"Error: {e}")
_rich_error(f"Error: {e}", symbol="error")
sys.exit(1)
```

### Table Creation
```python
try:
table = Table(title="🚀 Title", show_header=True, header_style="bold cyan")
table = Table(title="Title", show_header=True, header_style="bold cyan")
table.add_column("Name", style="bold white")
table.add_column("Details", style="white")
console.print(table)
Expand All @@ -103,7 +99,7 @@ except (ImportError, NameError):
### Panel Usage
```python
try:
_rich_panel(content, title="📋 Section Title", style="cyan")
_rich_panel(content, title="Section Title", style="cyan")
except (ImportError, NameError):
# Simple text fallback
```
Expand Down Expand Up @@ -135,11 +131,12 @@ except (ImportError, NameError):

## What NOT to Do

- ❌ Never use plain `click.echo()` without styling
- ❌ Don't mix color schemes or symbols inconsistently
- ❌ Avoid walls of text without visual structure
- ❌ Don't forget Rich import fallbacks
- ❌ Never sacrifice functionality for visuals
- **Never** use plain `click.echo()` without styling
- **Never** mix color schemes or symbols inconsistently
- **Never** create walls of text without visual structure
- **Never** forget Rich import fallbacks
- **Never** sacrifice functionality for visuals
- **Never** use emojis or non-ASCII characters in source code or CLI output

## Documentation Sync Requirements

Expand All @@ -158,7 +155,7 @@ When changing CLI functionality, update these sections in `docs/cli-reference.md
- Quick reference sections

### Documentation Standards
- Use the same emojis in documentation as in CLI help text
- Use plain ASCII text in documentation (no emojis in CLI help text or output examples)
- Include realistic, working examples that users can copy-paste
- Document both success and error scenarios
- Keep examples current with the latest syntax
Expand Down
43 changes: 43 additions & 0 deletions .github/instructions/encoding.instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
applyTo: "**"
description: "Cross-platform encoding rules — keep all source and CLI output within printable ASCII"
---

# Encoding Rules

## Constraint

All source code files and CLI output strings must stay within **printable ASCII** (U+0020–U+007E).

Do NOT use:
- Emojis (e.g. `🚀`, `✨`, `❌`)
- Unicode box-drawing characters (e.g. `─`, `│`, `┌`)
- Em dashes (`—`), en dashes (`–`), curly quotes (`"`, `"`, `'`, `'`)
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "curly quotes" examples are currently shown as straight ASCII quotes (", '), so they don't illustrate what should be avoided. To keep the file ASCII-only (per the constraint), consider describing smart quotes by name and/or listing their codepoints (e.g. U+201C/U+201D/U+2018/U+2019) rather than embedding the characters.

This issue also appears on line 3 of the same file.

Copilot uses AI. Check for mistakes.
- Any character outside the ASCII range (codepoint > U+007E)

**Why**: Windows `cp1252` terminals raise `UnicodeEncodeError: 'charmap' codec can't encode character` for any character outside cp1252. Keeping output within ASCII guarantees identical behaviour on every platform without dual-path fallback logic.

## Status symbol convention

Use ASCII bracket notation consistently across all CLI output, help text, and log messages:

| Symbol | Meaning |
|--------|----------------------|
| `[+]` | success / confirmed |
| `[!]` | warning |
| `[x]` | error |
| `[i]` | info |
| `[*]` | action / processing |
| `[>]` | running / progress |

These map directly to the `STATUS_SYMBOLS` dict in `src/apm_cli/utils/console.py`.
Comment on lines +20 to +33
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The status symbol table here doesn't include [#] (used for lists/metrics in STATUS_SYMBOLS), and the sentence "map directly" is a bit misleading because STATUS_SYMBOLS maps keys (e.g. check, warning, list, metrics) to bracket strings. Consider either adding [#] to this table and/or clarifying that callers should pass the appropriate STATUS_SYMBOLS key (and ensure the semantic meaning matches the actual mapping in src/apm_cli/utils/console.py).

Copilot uses AI. Check for mistakes.

## Scope

This rule applies to:
- Python source files (`*.py`)
- CLI help strings and command output
- Markdown documentation and instruction files under `.github/`
- Shell scripts and CI workflow files

Exception: binary assets and third-party vendored files are excluded.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Copilot encoding instructions: `encoding.instructions.md` (`applyTo: "**"`) bans non-ASCII characters in source and CLI output; updated `copilot-instructions.md` and `cli.instructions.md` to use ASCII bracket notation (`[+]`/`[!]`/`[x]`/`[i]`/`[*]`/`[>]`) instead of emoji STATUS_SYMBOLS (#282)

## [0.8.4] - 2026-03-22

### Added
Expand Down
Loading