Skip to content

Commit e31d54f

Browse files
committed
chore: remove outdated wiki commands from CLI
1 parent af429c2 commit e31d54f

File tree

3 files changed

+5
-307
lines changed

3 files changed

+5
-307
lines changed

.changeset/rude-candies-move.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@effect-app/cli": patch
3+
---
4+
5+
remove out of date wiki commands

packages/cli/src/index.ts

Lines changed: 0 additions & 217 deletions
Original file line numberDiff line numberDiff line change
@@ -698,221 +698,6 @@ Effect
698698
Command.withDescription("Generate and update package.json exports mappings for all packages in monorepo")
699699
)
700700

701-
const wiki = Command
702-
.make(
703-
"wiki",
704-
{},
705-
Effect.fn("effa-cli.wiki")(function*() {
706-
const action = yield* Prompt.select({
707-
choices: [{
708-
title: "sync",
709-
description: "Initialize and update the documentation submodule",
710-
value: "sync"
711-
}, {
712-
title: "update",
713-
description: "Pull latest changes from remote, commit and push changes within the submodule",
714-
value: "update"
715-
}],
716-
message: "Select wiki action"
717-
})
718-
719-
const syncCommand = runNodeCommandEC("git submodule update --init --recursive --remote doc")
720-
721-
switch (action) {
722-
case "sync": {
723-
yield* Effect.logInfo("Initializing/updating git submodule for documentation...")
724-
725-
if ((yield* syncCommand) !== 0) {
726-
return yield* Effect.fail(`Failed to sync submodule`)
727-
}
728-
729-
break
730-
}
731-
case "update": {
732-
yield* Effect.logInfo("Pulling latest changes from remote submodule...")
733-
734-
if ((yield* syncCommand) !== 0) {
735-
return yield* Effect.fail(`Failed to sync submodule`)
736-
}
737-
738-
const commitMessage = yield* Prompt.text({
739-
message: "Enter commit message:",
740-
default: "update doc",
741-
validate: (input) =>
742-
input.trim().length > 0
743-
? Effect.succeed(input.trim())
744-
: Effect.fail("Commit message cannot be empty")
745-
})
746-
747-
yield* Effect.logInfo("Committing and pushing changes in submodule...")
748-
749-
if (
750-
(yield* runNodeCommandEC(
751-
`git -C doc add . && git -C doc commit -m '${commitMessage}' && git -C doc push`
752-
)) === 0
753-
) {
754-
yield* Effect.logInfo("Submodule updated and pushed successfully")
755-
}
756-
757-
break
758-
}
759-
default: {
760-
action satisfies never
761-
return yield* Effect.fail(`Unknown wiki action: ${action}. Available actions: sync, update`)
762-
}
763-
}
764-
765-
// check if references to submodule have changed in main repo
766-
// and offer to commit these changes
767-
const statusOutput = yield* runNodeCommand("git status --porcelain")
768-
769-
const hasSubmoduleChanges = statusOutput
770-
.split("\n")
771-
.some((line) => line.trim().endsWith("doc") && line.trim().startsWith("M "))
772-
773-
if (hasSubmoduleChanges) {
774-
const shouldCommitSubmodule = yield* Prompt.confirm({
775-
message: "Changes to the submodule detected in main repository. Commit these changes?",
776-
initial: false
777-
})
778-
779-
if (
780-
shouldCommitSubmodule
781-
) {
782-
const mainCommitMessage = yield* Prompt.text({
783-
message: "Enter commit message for main repository:",
784-
default: "update doc submodule reference",
785-
validate: (input) =>
786-
input.trim().length > 0
787-
? Effect.succeed(input.trim())
788-
: Effect.fail("Commit message cannot be empty")
789-
})
790-
791-
if (
792-
(yield* runNodeCommandEC(
793-
`git commit -m '${mainCommitMessage}' doc`
794-
)) === 0
795-
) {
796-
yield* Effect.logInfo("Main repository updated with submodule changes successfully")
797-
} else {
798-
yield* Effect.logError("Failed to commit submodule changes in main repository")
799-
}
800-
} else {
801-
yield* Effect.logInfo("Remember to commit the submodule changes in the main repository later.")
802-
}
803-
} else {
804-
yield* Effect.logInfo("No changes to the submodule detected in main repository.")
805-
}
806-
})
807-
)
808-
.pipe(Command.withDescription(
809-
`Manage the documentation wiki git submodule with interactive action selection.
810-
811-
Available actions:
812-
- sync: Initialize and update the documentation submodule from remote
813-
- update: Pull latest changes, commit and push changes within the submodule
814-
815-
After any action, automatically detects and offers to commit submodule reference changes in the main repository.`
816-
))
817-
818-
const initWiki = Command
819-
.make(
820-
"init-wiki",
821-
{},
822-
Effect.fn("effa-cli.initWiki")(function*({}) {
823-
yield* Effect.logInfo("⚠️ IMPORTANT: This is a one-time project setup command!")
824-
825-
// check if doc directory already exists in git index
826-
const docInIndex = yield* runNodeCommand("git ls-files")
827-
.pipe(
828-
Effect.map((output) => output.split("\n").some((line) => line.startsWith("doc/") || line === "doc")),
829-
Effect.catchAll(() => Effect.succeed(false))
830-
)
831-
832-
if (docInIndex) {
833-
return yield* Effect.logError(`❌ ERROR: A 'doc' directory already exists in the git index!
834-
835-
This suggests the wiki submodule may have been initialized before, or there are conflicting files.
836-
837-
Required actions before proceeding:
838-
1. Move existing doc files to GitHub wiki or another location
839-
2. Remove the doc directory from filesystem: rm -rf doc
840-
3. Remove the doc directory from git index: git rm --cached -r doc
841-
4. Commit the removal: git commit -m "Remove doc directory"
842-
5. Re-run this command
843-
844-
Operation cancelled for safety.`)
845-
}
846-
847-
const confirmation = yield* Prompt.confirm({
848-
message: `This command will initialize the wiki submodule for this project.
849-
850-
⚠️ WARNING: This is NOT the command to use for local submodule initialization!
851-
852-
This command should only be run ONCE in the entire project history by a project maintainer to:
853-
- Set up the initial .gitmodules configuration
854-
- Add the wiki submodule to the repository
855-
- Commit the submodule configuration
856-
857-
For normal local development, use 'effa wiki sync' instead.
858-
859-
Are you sure you want to proceed with the one-time project setup?`,
860-
initial: false
861-
})
862-
863-
if (!confirmation) {
864-
return yield* Effect.logInfo("Operation cancelled. Use 'effa wiki sync' for normal wiki operations.")
865-
}
866-
867-
yield* Effect.logInfo("Extracting project name from git remote...")
868-
const remoteUrl = yield* runNodeCommand("git config --get remote.origin.url")
869-
870-
// extract project name from URL (supports both SSH and HTTPS)
871-
//
872-
// - [email protected]:user/project-name.git -> project-name
873-
// - https://github.com/user/project-name.git -> project-name
874-
let detectedProjectName = remoteUrl
875-
.split("/")
876-
.pop()
877-
?.replace(/\.git$/, "")
878-
?.trim()
879-
880-
yield* detectedProjectName
881-
? Effect.logInfo(`Detected project name from git remote: ${detectedProjectName}`)
882-
: Effect.logWarning("Could not determine project name from git remote")
883-
884-
detectedProjectName = yield* Prompt.text({
885-
message: detectedProjectName
886-
? "Please confirm or modify the project name:"
887-
: "Please enter the project name:",
888-
...detectedProjectName && { default: detectedProjectName },
889-
validate: (input) =>
890-
input.trim().length > 0
891-
? Effect.succeed(input.trim())
892-
: Effect.fail("Project name cannot be empty")
893-
})
894-
895-
yield* Effect.logInfo(`Using project name: ${detectedProjectName}`)
896-
897-
yield* Effect.logInfo("Creating .gitmodules file...")
898-
yield* runNodeCommandEC(`echo '' >> .gitmodules`)
899-
yield* runNodeCommandEC(`echo '[submodule "doc"]' >> .gitmodules`)
900-
yield* runNodeCommandEC(`echo ' path = doc' >> .gitmodules`)
901-
yield* runNodeCommandEC(`echo ' url = ../${detectedProjectName}.wiki.git' >> .gitmodules`)
902-
yield* runNodeCommandEC(`echo ' branch = master' >> .gitmodules`)
903-
yield* runNodeCommandEC(`echo ' update = merge' >> .gitmodules`)
904-
905-
yield* Effect.logInfo("Adding git submodule for documentation wiki...")
906-
yield* runNodeCommandEC(`git submodule add -b master ../${detectedProjectName}.wiki.git doc`)
907-
908-
yield* Effect.logInfo("Committing wiki submodule addition...")
909-
yield* runNodeCommandEC("git add . && git commit -am 'Add doc submodule'")
910-
911-
return yield* Effect.logInfo("Wiki submodule initialized successfully")
912-
})
913-
)
914-
.pipe(Command.withDescription("Set up the wiki submodule for the project (one-time setup)"))
915-
916701
const nuke = Command
917702
.make(
918703
"nuke",
@@ -960,8 +745,6 @@ Are you sure you want to proceed with the one-time project setup?`,
960745
indexMulti,
961746
packagejson,
962747
packagejsonPackages,
963-
wiki,
964-
initWiki,
965748
nuke
966749
])),
967750
{

wiki/effect‐app‐cli.md

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ node packages/cli/dist/index.js effa <command>
2727
| `effa index-multi` | Monitor controller and index files for auto-eslint fixes |
2828
| `effa packagejson` | Generate and monitor export mappings for root package.json |
2929
| `effa packagejson-packages` | Generate and monitor export mappings for all packages |
30-
| `effa wiki` | Interactive wiki submodule management (sync/update) |
31-
| `effa init-wiki` | **[Maintainer Only]** One-time wiki submodule setup |
3230
| `effa nuke` | Nuclear cleanup - remove all generated files and directories |
3331

3432
## Available Commands
@@ -146,94 +144,6 @@ pnpm effa packagejson-packages
146144
4. Generates exports for all found packages
147145
5. Monitors each package for changes
148146

149-
### `effa wiki` - Documentation Wiki Management
150-
151-
Manages the documentation wiki git submodule with interactive action selection for updating and synchronizing documentation.
152-
153-
```bash
154-
pnpm effa wiki
155-
```
156-
157-
**⚠️ ACHTUNG - Important Git Submodule Behavior:**
158-
> **Submodule operations will change the commit reference in the main project repository!**
159-
> When you run `effa wiki`, the git submodule reference in your main project may be updated to point to the latest commit in the submodule.
160-
> **The CLI will automatically detect these changes and offer to commit the new submodule reference** in the main project repository.
161-
162-
**Interactive Selection:**
163-
When you run the command, you'll get a menu to choose the action:
164-
- **sync**: Initialize and update the documentation submodule from remote
165-
- **update**: Pull latest changes, commit and push changes within the submodule
166-
167-
**Available Actions:**
168-
169-
#### `sync`
170-
Updates or initializes the documentation submodule from remote:
171-
172-
💡 **Run this periodically to keep your local documentation up-to-date**
173-
174-
**What it does:**
175-
- Runs `git submodule update --init --recursive --remote doc`
176-
- Pulls the latest changes from the remote submodule repository
177-
- Automatically detects if submodule reference changed in main repo
178-
- Offers to commit the submodule reference changes
179-
180-
#### `update`
181-
Interactive workflow to update and commit changes within the submodule:
182-
183-
**What it does:**
184-
1. Pulls latest changes from remote submodule (same as sync)
185-
2. Prompts for a commit message (default: "update doc")
186-
3. Stages all changes in the submodule
187-
4. Commits and pushes changes to the remote submodule repository
188-
5. Automatically detects if submodule reference changed in main repo
189-
6. Offers to commit the submodule reference changes
190-
191-
### `effa init-wiki` - Wiki Submodule Setup
192-
193-
**⚠️ PROJECT MAINTAINER ONLY - ONE-TIME SETUP COMMAND**
194-
195-
Sets up the wiki submodule for the project. This is a standalone command that should only be run once in the project's entire history by a project maintainer.
196-
197-
```bash
198-
pnpm effa init-wiki
199-
```
200-
201-
**What it does:**
202-
1. **Safety checks**: Verifies no existing `doc` directory exists in git index
203-
2. **Confirmation prompt**: Requires explicit confirmation with detailed warnings
204-
3. **Project detection**: Extracts project name from git remote URL (supports SSH and HTTPS)
205-
4. **Manual override**: Allows manual project name input or modification
206-
5. **Submodule setup**: Creates `.gitmodules` configuration file
207-
6. **Repository integration**: Adds the wiki submodule (`../{project-name}.wiki.git`)
208-
7. **Automatic commit**: Commits the submodule configuration to the main repository
209-
210-
**⚠️ CRITICAL WARNINGS:**
211-
- **NOT for local development**: This is NOT the command for local submodule initialization!
212-
- **ONE-TIME ONLY**: Should only be run ONCE by a project maintainer during initial project setup
213-
- **Repository modification**: Modifies the main repository by adding submodule configuration
214-
- **Use `effa wiki sync` instead** for normal local development submodule initialization
215-
216-
**Safety Features:**
217-
- Checks for existing `doc` directory conflicts before proceeding
218-
- Requires explicit user confirmation with detailed warnings
219-
- Provides clear guidance for different scenarios
220-
- Auto-detects project name but allows manual override
221-
222-
**Example workflow:**
223-
```bash
224-
# Project maintainer runs this ONCE during project setup:
225-
pnpm effa init-wiki
226-
# ⚠️ IMPORTANT: This is a one-time project setup command!
227-
# This command will initialize the wiki submodule for this project...
228-
# Detected project name from git remote: my-awesome-project
229-
# Please confirm or modify the project name: my-awesome-project
230-
# ✅ Wiki submodule initialized successfully
231-
232-
# Later, other developers use:
233-
pnpm effa wiki
234-
# Choose: sync
235-
```
236-
237147
### `effa nuke` - Nuclear Cleanup
238148

239149
Performs deep cleanup by removing all generated files and directories from the workspace.

0 commit comments

Comments
 (0)