fix: resolve missing ~/.ccs/.claude/ directory during npm install (v4.3.7) (#16)

* fix(postinstall): make ora dependency optional to fix missing ~/.ccs/.claude/ directory

The root cause was that `ora` module was not available during `npm install`
when the postinstall script runs, causing both:
- .claude/ directory copy to fail (ClaudeDirInstaller)
- Symlink creation to fail (ClaudeSymlinkManager)

This resulted in the ~/.ccs/.claude/ directory not being created.

Changes:
- Made ora import optional in ClaudeDirInstaller
- Made ora import optional in ClaudeSymlinkManager
- Both classes now gracefully fallback to console.log when ora is unavailable
- Postinstall now successfully creates ~/.ccs/.claude/ and symlinks

Tested: Clean install now properly creates all directories and symlinks

* chore: bump version to 4.3.7

Version 4.3.7 - Postinstall Fix Release

Changes:
- Fixed missing ~/.ccs/.claude/ directory during npm install
- Made ora dependency optional in installer utilities
- Added CHANGELOG entry documenting the fix

Files updated:
- VERSION: 4.3.6 -> 4.3.7
- package.json: version updated
- lib/ccs: version string updated
- lib/ccs.ps1: version string updated
- installers/install.sh: version string updated
- installers/install.ps1: version string updated
- CHANGELOG.md: added 4.3.7 release notes
This commit is contained in:
Kai (Tam Nhu) Tran
2025-11-22 19:43:50 -05:00
committed by GitHub
parent 4d07471f44
commit e97311cd3b
9 changed files with 40 additions and 10 deletions
+14
View File
@@ -2,6 +2,20 @@
Format: [Keep a Changelog](https://keepachangelog.com/)
## [4.3.7] - 2025-11-23
### Fixed
- **Postinstall Script**: Fixed missing `~/.ccs/.claude/` directory during `npm install`
- Made `ora` dependency optional in `ClaudeDirInstaller` and `ClaudeSymlinkManager`
- Postinstall script now gracefully handles missing `ora` module during installation
- Ensures `.claude/` directory and symlinks are properly created even when `ora` is unavailable
### Technical Details
- Root cause: `ora` module not available during `npm install` postinstall execution
- Solution: Optional require with fallback to `console.log` when `ora` is unavailable
- Affects: `bin/utils/claude-dir-installer.js`, `bin/utils/claude-symlink-manager.js`
- Impact: All npm installations now properly create `~/.ccs/.claude/` and CCS symlinks
## [4.3.6] - 2025-11-23
### Added
+1 -1
View File
@@ -1 +1 @@
4.3.6
4.3.7
+10 -2
View File
@@ -4,7 +4,15 @@
const fs = require('fs');
const path = require('path');
const os = require('os');
const ora = require('ora');
// Make ora optional (might not be available during npm install postinstall)
let ora = null;
try {
ora = require('ora');
} catch (e) {
// ora not available, will use console.log instead
}
const { colored } = require('./helpers');
/**
@@ -23,7 +31,7 @@ class ClaudeDirInstaller {
* @param {boolean} silent - Suppress spinner output
*/
install(packageDir, silent = false) {
const spinner = silent ? null : ora('Copying .claude/ items to ~/.ccs/.claude/').start();
const spinner = (silent || !ora) ? null : ora('Copying .claude/ items to ~/.ccs/.claude/').start();
try {
// Auto-detect package directory if not provided
+10 -2
View File
@@ -3,7 +3,15 @@
const fs = require('fs');
const path = require('path');
const os = require('os');
const ora = require('ora');
// Make ora optional (might not be available during npm install postinstall)
let ora = null;
try {
ora = require('ora');
} catch (e) {
// ora not available, will use console.log instead
}
const { colored } = require('./helpers');
/**
@@ -37,7 +45,7 @@ class ClaudeSymlinkManager {
* Safe: backs up existing files before creating symlinks
*/
install(silent = false) {
const spinner = silent ? null : ora('Installing CCS items to ~/.claude/').start();
const spinner = (silent || !ora) ? null : ora('Installing CCS items to ~/.claude/').start();
// Ensure ~/.ccs/.claude/ exists (should be shipped with package)
if (!fs.existsSync(this.ccsClaudeDir)) {
+1 -1
View File
@@ -31,7 +31,7 @@ $InstallMethod = if ($ScriptDir -and ((Test-Path "$ScriptDir\lib\ccs.ps1") -or (
# IMPORTANT: Update this version when releasing new versions!
# This hardcoded version is used for standalone installations (irm | iex)
# For git installations, VERSION file is read if available
$CcsVersion = "4.3.6"
$CcsVersion = "4.3.7"
# Try to read VERSION file for git installations
if ($ScriptDir) {
+1 -1
View File
@@ -32,7 +32,7 @@ fi
# IMPORTANT: Update this version when releasing new versions!
# This hardcoded version is used for standalone installations (curl | bash)
# For git installations, VERSION file is read if available
CCS_VERSION="4.3.6"
CCS_VERSION="4.3.7"
# Try to read VERSION file for git installations
if [[ -f "$SCRIPT_DIR/VERSION" ]]; then
+1 -1
View File
@@ -2,7 +2,7 @@
set -euo pipefail
# Version (updated by scripts/bump-version.sh)
CCS_VERSION="4.3.6"
CCS_VERSION="4.3.7"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly CONFIG_FILE="${CCS_CONFIG:-$HOME/.ccs/config.json}"
readonly PROFILES_JSON="$HOME/.ccs/profiles.json"
+1 -1
View File
@@ -12,7 +12,7 @@ param(
$ErrorActionPreference = "Stop"
# Version (updated by scripts/bump-version.sh)
$CcsVersion = "4.3.6"
$CcsVersion = "4.3.7"
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$ConfigFile = if ($env:CCS_CONFIG) { $env:CCS_CONFIG } else { "$env:USERPROFILE\.ccs\config.json" }
$ProfilesJson = "$env:USERPROFILE\.ccs\profiles.json"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@kaitranntt/ccs",
"version": "4.3.6",
"version": "4.3.7",
"description": "Claude Code Switch - Instant profile switching between Claude Sonnet 4.5 and GLM 4.6",
"keywords": [
"cli",