Skip to content

v0.3.2: UX improvements - simplified output, unified commands, streamlined statusline#4

Merged
dean0x merged 4 commits intomainfrom
feature/improve-init-output
Oct 17, 2025
Merged

v0.3.2: UX improvements - simplified output, unified commands, streamlined statusline#4
dean0x merged 4 commits intomainfrom
feature/improve-init-output

Conversation

@dean0x
Copy link
Copy Markdown
Owner

@dean0x dean0x commented Oct 17, 2025

Summary

This PR contains UX improvements and code simplification for the v0.3.2 patch release.

Changes

1. Simplified init command output (refactor)

  • Reduced output from ~60-80 lines to ~10-15 lines (70-85% reduction)
  • Added package version display in header
  • Moved --force prompt earlier for better UX
  • Removed verbose per-component installation logs
  • Condensed status messages to essential checkmarks
  • Streamlined final output (removed WHAT'S INSTALLED, SMART STATUSLINE, QUICK START sections)

2. Unified review commands (refactor)

  • Consolidated /pre-commit + /pre-pr → /code-review
  • Removed redundant /pre-commit command (was subset of pre-pr)
  • Single command handles both uncommitted changes and full branch reviews
  • Reduces cognitive overhead (8 commands instead of 9)
  • Updated all documentation references

3. Streamlined statusline (refactor)

  • 28% code reduction (115 lines → 83 lines)
  • Removed: cost tracking, API usage stats, session duration, commit messages
  • Added: model name display, CPU usage, memory usage (cross-platform)
  • Changed separator from " / " to " " for cleaner look
  • Maintained: git branch, uncommitted indicator, large context warning

4. Better init command output (improve)

  • Replaced problematic "cd && /catch-up" suggestion
  • Added commands reference showing all 8 available slash commands
  • Provides immediate value without risk of failure on fresh projects

Test Plan

  • Build succeeds (npm run build)
  • No tests defined (as expected)
  • Manual testing of all changes
  • All commits are atomic and follow conventions

Release Notes

This will be released as v0.3.2 (patch) - UX improvements and code quality enhancements with no breaking changes.

🤖 Generated with Claude Code

Dean Sharon and others added 4 commits October 17, 2025 21:16
Reduce init output from ~60-80 lines to ~10-15 lines by removing
verbose installation logs and condensing status messages. Improves
signal-to-noise ratio while preserving essential information.

Changes:
- Add package version display in header
- Move --force prompt earlier for better UX
- Remove verbose per-component installation logs
- Condense status messages to essential checkmarks
- Simplify final output (remove WHAT'S INSTALLED, SMART STATUSLINE, etc)
- Streamline manual merge warnings

Output now focuses on critical information: detected environment,
installation status, warnings for manual actions, and quick start.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Simplified the review command structure by removing redundancy
and improving semantic clarity:

- Removed /pre-commit command (redundant functionality)
- Renamed /pre-pr → /code-review for clearer intent
- Updated all documentation references (README.md, CLAUDE.md)
- Single unified command now handles both uncommitted changes
  and full branch reviews

Benefits:
- Reduces cognitive overhead (one review command to remember)
- Better naming reflects actual use case (code review)
- Maintains all functionality while improving discoverability

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Simplify statusline.sh by removing cost tracking, API metrics, and
session duration in favor of practical system monitoring. This reduces
script complexity by 28% (115 to 83 lines) while adding more useful
real-time information.

Changes:
- Remove cost tracking, API usage stats, commit messages, duration
- Add cross-platform CPU usage detection (top/ps fallback)
- Add cross-platform memory usage detection (free/vm_stat)
- Add model name display to statusline
- Change separator from " / " to "  " for minimal aesthetic
- Maintain git branch, uncommitted changes, large context warning

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Replace the problematic "cd <project> && /catch-up" suggestion
with a comprehensive commands reference showing all 8 available
slash commands. This provides immediate value and visibility
without suggesting /catch-up on fresh projects where it may fail.

Commands listed:
- /catch-up: Session context and status
- /research: Pre-implementation planning
- /code-review: Comprehensive code review
- /commit: Intelligent atomic commits
- /devlog: Session documentation
- /debug: Systematic debugging
- /release: Release automation
- /plan-next-steps: Extract actionable tasks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@dean0x dean0x merged commit c17bd6d into main Oct 17, 2025
dean0x pushed a commit that referenced this pull request Oct 24, 2025
…ions, async operations

Code Quality Improvements:
- Extract shared utilities to src/cli/utils/ (eliminated 65 lines of duplication)
- Created paths.ts with getInstallationPaths(), path validation, env var security
- Created git.ts with async getGitRoot() using promisified exec
- Both init.ts and uninstall.ts now use shared utilities

Security & Reliability:
- Fixed TOCTOU race conditions with atomic file operations ('wx' flag)
- settings.json, CLAUDE.md, .claudeignore now use exclusive create
- Added environment variable path validation (CLAUDE_CODE_DIR, DEVFLOW_DIR)
- Validates absolute paths, warns if outside home directory

Performance:
- Replaced execSync with async exec (non-blocking git operations)
- Eliminated redundant git root detection (was called twice)
- All file operations now async throughout the codebase

CI/CD Compatibility:
- Added TTY detection for interactive prompts
- Falls back to default scope in non-interactive environments
- Clear messaging when non-TTY detected

Documentation:
- Added comprehensive CHANGELOG entry for v0.5.0
- Documented all fixes, improvements, and breaking changes
- Migration notes for existing users

Tested:
- User scope installation: ✓
- Local scope installation: ✓
- TTY detection and fallback: ✓
- Auto-detection uninstall: ✓
- Atomic file operations: ✓
- All async operations: ✓

Closes code review issues #2, #4, #5, #6

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
dean0x added a commit that referenced this pull request Oct 24, 2025
…vements (#16)

* feat: add installation scope support (global vs local)

Adds --scope option to init command allowing users to choose between:
- Global scope: install to ~/.claude/ (user-wide, all projects)
- Local scope: install to git-root/.claude/ (project-only)

Features:
- Interactive prompt when --scope not provided (defaults to global)
- New getInstallationPaths() function for scope-aware directory resolution
- Git root detection with security validation
- For local scope: creates .claude/ and .devflow/ in git repository root
- For local scope: automatically adds directories to .gitignore
- Updated output messages to indicate installation scope and paths
- Comprehensive README documentation with examples

Implementation:
- getGitRoot(): Detects git repository root with validation
- getInstallationPaths(scope): Returns paths based on scope
- For global: uses existing ~/.claude/ and ~/.devflow/
- For local: uses <git-root>/.claude/ and <git-root>/.devflow/
- Skip Claude Code detection for local scope (create directory instead)

Testing:
- Global scope: Verified existing behavior maintained
- Local scope: Successfully tested in devflow repository
- Both scopes create all components correctly

Use cases:
- Global: Personal development across all projects
- Local: Team projects where DevFlow should be project-specific
- Local: CI/CD environments with project-scoped configuration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: rename "global" scope to "user" for clarity

Changes all references from "global" to "user":
- TypeScript types: 'global' | 'local' → 'user' | 'local'
- CLI option: --scope <global|local> → --scope <user|local>
- Interactive prompt: "Choose scope (global/local)" → "Choose scope (user/local)"
- Output messages: "global" → "user"
- README documentation: "Global Scope" → "User Scope"

Rationale: "user" is clearer and more precise than "global"
- "user scope" = user-wide installation (~/.claude/)
- "local scope" = project-specific installation (git-root/.claude/)

All functionality remains the same, only naming improved.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: add scope support to uninstall command

Enhanced uninstall command to support both user and local scopes:

Features:
- Auto-detects installed scopes (user and/or local) if --scope not specified
- --scope option: user, local, or both
- Uninstalls from user scope (~/.claude/, ~/.devflow/)
- Uninstalls from local scope (git-root/.claude/, git-root/.devflow/)
- Clear output showing which scope is being uninstalled
- Handles cases where DevFlow installed in multiple scopes

Auto-detection logic:
- Checks ~/.claude/commands/devflow/ for user scope
- Checks git-root/.claude/commands/devflow/ for local scope
- If both found, uninstalls from both with notification
- If none found, exits with helpful message

Usage examples:
- devflow uninstall (auto-detects and uninstalls from all found scopes)
- devflow uninstall --scope user (explicit user scope only)
- devflow uninstall --scope local (explicit local scope only)
- devflow uninstall --scope both (force uninstall from both)

Testing:
- Verified local scope uninstall removes git-root/.claude/commands/devflow/
- Verified directories properly cleaned up
- Verified error handling for non-git repositories

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: remove "both" option from uninstall, auto-detect is default

Simplified uninstall command:
- Removed --scope both option (excessive)
- Default behavior (no --scope): auto-detect and uninstall from all found scopes
- --scope user: uninstall from user scope only
- --scope local: uninstall from local scope only

Rationale: Default should be smart and do the right thing automatically.
Users who want specific scope can use --scope flag.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: simplify settings/CLAUDE.md installation - never override

Simplified file installation behavior:
- Never override or rename existing files
- Always install adjacent files (settings.devflow.json, CLAUDE.devflow.md)
- User manually merges desired changes into their existing files

Changes:
- Removed complex backup/rename logic (managed-settings.json)
- Removed --force and -y options (no longer needed)
- Removed forceOverride logic and prompts
- Simplified to simple exists check: install as .devflow.* if exists

Installation behavior now:
- settings.json exists? → Install as settings.devflow.json
- settings.json missing? → Install as settings.json
- CLAUDE.md exists? → Install as CLAUDE.devflow.md
- CLAUDE.md missing? → Install as CLAUDE.md

Final message shows clear merge instructions:
- Review settings.devflow.json and merge statusLine config
- Review CLAUDE.devflow.md and adopt desired practices

Benefits:
- Much simpler code (~80 lines removed)
- Never touches user's existing files
- Clear instructions for manual merge
- No complex state management
- No backup/restore logic needed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* refactor: address code review issues - extract utils, fix race conditions, async operations

Code Quality Improvements:
- Extract shared utilities to src/cli/utils/ (eliminated 65 lines of duplication)
- Created paths.ts with getInstallationPaths(), path validation, env var security
- Created git.ts with async getGitRoot() using promisified exec
- Both init.ts and uninstall.ts now use shared utilities

Security & Reliability:
- Fixed TOCTOU race conditions with atomic file operations ('wx' flag)
- settings.json, CLAUDE.md, .claudeignore now use exclusive create
- Added environment variable path validation (CLAUDE_CODE_DIR, DEVFLOW_DIR)
- Validates absolute paths, warns if outside home directory

Performance:
- Replaced execSync with async exec (non-blocking git operations)
- Eliminated redundant git root detection (was called twice)
- All file operations now async throughout the codebase

CI/CD Compatibility:
- Added TTY detection for interactive prompts
- Falls back to default scope in non-interactive environments
- Clear messaging when non-TTY detected

Documentation:
- Added comprehensive CHANGELOG entry for v0.5.0
- Documented all fixes, improvements, and breaking changes
- Migration notes for existing users

Tested:
- User scope installation: ✓
- Local scope installation: ✓
- TTY detection and fallback: ✓
- Auto-detection uninstall: ✓
- Atomic file operations: ✓
- All async operations: ✓

Closes code review issues #2, #4, #5, #6

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* chore: bump version to 0.5.0

Release 0.5.0 with installation scope support and smart uninstall detection

Major Features:
- Two-tier installation strategy (user-wide vs project-specific)
- Interactive scope selection with clear descriptions
- Smart uninstall with automatic scope detection
- Environment variable path validation for security
- TTY detection for CI/CD compatibility

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Dean Sharon <deanshrn@gmain.com>
Co-authored-by: Claude <noreply@anthropic.com>
@dean0x dean0x deleted the feature/improve-init-output branch October 24, 2025 20:55
dean0x pushed a commit that referenced this pull request Mar 25, 2026
- Replace per-line subprocess spawning in extract_batch_messages with
  single-pass jq/node processing (issue #1)
- Decompose process_observations into validate_observation,
  calculate_confidence, and check_temporal_spread helpers (issue #2)
- Fix duplicate temporal spread calculation by computing epoch once
  in check_temporal_spread (issue #3)
- Escape double quotes in ART_DESC for YAML frontmatter safety (issue #4)
- Strengthen ART_NAME sanitization with strict kebab-case allowlist (issue #5)
- Replace per-line subprocess in apply_temporal_decay with single-pass
  jq operation and node fallback (issue #6)
- Replace per-line subprocess in create_artifacts status update with
  single-pass jq/node operation (issue #7)
- Remove dead increment_daily_counter function (issue #8)
- Extract write_command_artifact and write_skill_artifact helpers
  from create_artifacts (issue #9)
- Change flat 30k char truncation to per-session 8k char cap for
  proportional session contribution (issue #10)
- Add section comment markers to build_sonnet_prompt heredoc for
  navigability (issue #11)
dean0x pushed a commit that referenced this pull request Apr 13, 2026
Addresses 9 issues found in the r1-init-migrations review batch:

- #1: Move runMigrations block before installViaFileCopy so V1→V2 shadow
  renames complete before the installer looks for V2-named directories
- #2: Extend Migration.run to return MigrationRunResult { infos, warnings };
  both registry entries now surface migrated counts and conflict warnings to
  init.ts, which logs them via p.log.info / p.log.warn after the migration loop
- #3 (ISP): Split MigrationContext into GlobalMigrationContext | PerProjectMigrationContext
  discriminated union; drop unused claudeDir field; empty-string sentinels removed
- #4: Cap per-project Promise.allSettled concurrency at 16 via pooled() helper to
  avoid EMFILE on machines with 50-200 projects
- #5: Accumulate newlyApplied in memory and write state once at end of
  runMigrations — eliminates O(N²) writeAppliedMigrations calls per run
- #6: Use { flag: 'wx' } exclusive-create on .tmp file with unlink+retry on
  EEXIST to prevent TOCTOU symlink writes
- #7: Add exhaustiveness assertion (never) on migration.scope dispatch so future
  union extensions cause a runtime throw instead of silent no-op
- #8 (D37): Document vacuous-truth edge case in runMigrations comment block where
  discoveredProjects=[] marks per-project migration applied without sweeping any project
- #9: Convert applied array to Set<string> before the migration loop for O(1)
  .has() lookups instead of O(N) .includes() per migration

Co-Authored-By: Claude <noreply@anthropic.com>
dean0x pushed a commit that referenced this pull request Apr 13, 2026
…ision and Migration casts

- Create src/cli/utils/fs-atomic.ts: canonical TS writeFileAtomicExclusive with
  race-tolerant unlink (try/catch before retry), matching CJS json-helper.cjs
  and knowledge-usage-scan.cjs. All 3 TS atomic-write call sites (learn.ts,
  legacy-knowledge-purge.ts, migrations.ts) now import from this single source.

- Create src/cli/utils/notifications-shape.ts: consolidated NotificationEntry
  interface and isNotificationMap guard using the STRONGER definition (validates
  both top-level map and each entry value). Imported by learn.ts and
  notifications.ts, eliminating the two incompatible local definitions.

- Rebase legacy-knowledge-purge.ts D35 → D39 (D35 was colliding with the
  per-project concurrency cap decision in migrations.ts).

- Extract runGlobalMigration and runPerProjectMigration helpers from the 112-line
  runMigrations body. Each helper encapsulates one scope's dispatch logic including
  error handling; runMigrations now orchestrates loading/saving state + dispatches.

- Remove direct as Migration<'global'>/'per-project' casts from the original inline
  dispatch (HIGH #4). Casts are re-introduced only at the new helper-call boundary
  with explicit comments explaining the generic-narrowing constraint.

- MED #7 (init.ts warn/info level): confirmed already correct — no change needed.

Co-Authored-By: Claude <noreply@anthropic.com>
dean0x pushed a commit that referenced this pull request Apr 13, 2026
…rd and TOCTOU tests

MED #4: Extract reportMigrationResult() to migrations.ts (co-located with RunMigrationsResult
and MigrationLogger types). Removes the 17-line, 5-branch reporting block from
runMigrationsWithFallback in init.ts; init.ts now delegates to the extracted helper.
MigrationLogger and reportMigrationResult are exported from migrations.ts;
init.ts re-exports MigrationLogger for backward compat.

MED #6+#8: Split isRawObservation into two phases. Introduce VALID_OBSERVATION_TYPES
constant as the single source of truth for valid type values — drives both the guard
(phase 1: required fields + includes check) and the exhaustiveness check in the switch
(the const type union constrains ObservationType). Extract isOptBool() helper for the
three optional flag checks (phase 2), eliminating the mixed-concern boolean chain.

MED #10: Add adversarial-input tests for all four type guards.
- isRawObservation: 7 cases via getLearningCounts (invalid type, missing required fields,
  null/array JSON, non-boolean optional flag, valid minimal entry)
- isNotificationMap: 11 cases testing null/undefined/array/number/string/primitive-entry/
  null-entry/array-entry/empty-map/valid-entry/multi-entry
- isSeverity: 2 behavioral cases via getActiveNotification (unknown + null severity
  fall back to 'dim')
- reportMigrationResult: 8 cases covering all branches (empty, failure with/without
  project, infos, warnings, newlyApplied, verbose on/off)

MED #9: Add TOCTOU test for json-helper.cjs writeExclusive (via exported writeFileAtomic).
4 cases: basic write, overwrite, symlink pre-placed at .tmp path (sentinel unchanged),
stale .tmp from prior crash. Mirrors pattern from legacy-knowledge-purge.test.ts:218-244.

Tests: 884 total (852 prior + 32 new). Build: clean.

Co-Authored-By: Claude <noreply@anthropic.com>
dean0x pushed a commit that referenced this pull request Apr 16, 2026
Review walkthrough across 4 sessions resolved all 31 issues from the
2026-04-15_1022 code review (19 fixed, 5 rejected, 1 deferred, 6
pre-resolved).

Blocking fixes (sessions 1-2):
- CHANGELOG contradiction rewritten (#1)
- Worktree placeholder unified on "{worktree}" across 11 sites (#3)
- /debug migrated to index pattern (#4)
- KNOWLEDGE_CONTEXT quoting standardized, no inline fallback (#6)
- apply-knowledge skill defers to footer for paths (#7)
- Simplifier dropped from knowledge consumers; 4 agents canonicalized (#8)
- lstat+isFile guard on legacy-knowledge-purge unlink (#9)

Architecture + consistency fixes (session 2):
- Bare-form CLI removed, dispatch simplified to index-only (#10)
- code-review-teams template+table extraction (#12)
- Designer Apply Knowledge H2 added (#13)
- Teams phase numbering aligned (#14)
- loadKnowledgeContext + full subcommand removed entirely (#16)

Complexity + performance + testing + docs fixes (sessions 3-4):
- D-A filter extracted to isDeprecatedOrSuperseded predicate (#18)
- formatAdrLine/formatPfLine merged into formatEntryLine (#19)
- Shared test fixtures extracted to tests/knowledge/fixtures.ts (#21)
- Token claim "~250 tokens" dropped from 12 sites (#22)
- tmpdir cleanup added to test fixtures (#25)
- self-learning.md example and footer paths corrected (#28, #29)

28 files changed, 333 insertions, 524 deletions. 1021/1021 tests passing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant