@eldrforge/kodrdriv 1.2.137 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,53 @@
1
+ # Fix and Commit Workflow
2
+
3
+ ## Objective
4
+
5
+ Ensure that precommit checks pass successfully for a single package. When failures occur, understand the root cause, fix the issues, and iterate until all checks pass.
6
+
7
+ ## Workflow Steps
8
+
9
+ 1. **Run Precommit Check**
10
+ - Run `kodrdriv_precommit` with `fix=true` on the directory (${directory})
11
+ - This will execute precommit checks (linting, type checking, tests, build) for the single package
12
+
13
+ 2. **Handle Failures**
14
+ - If precommit fails, analyze the error output and fix the issues:
15
+ - For lint errors: Fix code style issues or disable specific rules with inline comments if justified
16
+ - For type errors: Fix TypeScript type issues
17
+ - For test failures: Update or fix tests to match new behavior
18
+ - For build failures: Fix compilation or bundling issues
19
+ - For coverage drops: Add tests to maintain coverage thresholds
20
+ - **Tip**: If the project uses lcov format for coverage reports and you're struggling with coverage thresholds, consider using the `brennpunkt` MCP server tools (e.g., `brennpunkt_get_priorities`, `brennpunkt_coverage_summary`, `brennpunkt_get_file_coverage`) to identify high-priority files and understand coverage gaps. Install brennpunkt as an MCP server with: `npx -y -p @redaksjon/brennpunkt brennpunkt-mcp`
21
+
22
+ 3. **Iterate Until Success**
23
+ - Re-run `kodrdriv_precommit` with `fix=true` after each fix until all checks pass
24
+
25
+ 4. **Commit Changes**
26
+ - Once precommit checks pass, commit the fixes using `kodrdriv_commit` with `sendit=true`
27
+ - The commit message will be automatically generated from the changes
28
+
29
+ ## Important Notes
30
+
31
+ - **Fix Flag**: Use `fix=true` to enable auto-fixing where possible, but manual fixes may still be required
32
+ - **Iterative Process**: Continue fixing and re-running precommit until all checks pass
33
+
34
+ ## Example Flow
35
+
36
+ ```
37
+ 1. kodrdriv_precommit({ directory: "/path/to/package", fix: true })
38
+ → Fails: TypeScript type error in src/index.ts:42
39
+
40
+ 2. Analyze error: TypeScript type error in src/index.ts:42
41
+ → Fix the type error
42
+
43
+ 3. kodrdriv_precommit({ directory: "/path/to/package", fix: true })
44
+ → Fails: Linting error in src/utils.ts:15
45
+
46
+ 4. Fix linting error
47
+
48
+ 5. kodrdriv_precommit({ directory: "/path/to/package", fix: true })
49
+ → All checks pass
50
+
51
+ 6. kodrdriv_commit({ directory: "/path/to/package", sendit: true })
52
+ → Commits all fixes
53
+ ```
@@ -0,0 +1,100 @@
1
+ # Publish Workflow
2
+
3
+ ## Objective
4
+
5
+ Execute a complete publishing workflow for a single package. Handle errors gracefully, fix issues as they arise, and resume appropriately.
6
+
7
+ ## Pre-Publish Verification
8
+
9
+ Before running `kodrdriv_publish`, verify that `kodrdriv_precommit` works successfully.
10
+
11
+ **Exception**: If `fix_and_commit` was just executed successfully, you can skip the precommit check and proceed directly to publish. The `fix_and_commit` workflow already ensures all precommit checks pass.
12
+
13
+ ## Publishing Workflow
14
+
15
+ 1. **Run Publish**
16
+ - Execute `kodrdriv_publish` with appropriate parameters
17
+ - The command will start generating output
18
+
19
+ 2. **Monitor for Errors**
20
+ - Watch for errors:
21
+ - **GitHub Actions/Workflows errors**: Build failures, test failures, or validation errors in Pull Requests
22
+ - **Git conflicts**: Merge conflicts or branch state issues
23
+ - **Precondition check failures**: Version conflicts, branch state issues, or dependency problems
24
+
25
+ 3. **Handle Pull Request Errors**
26
+ - If an error occurs during Pull Request validation:
27
+ - The error message will typically include a link to the failing PR or workflow
28
+ - Navigate to the provided link and investigate the build/test errors
29
+ - Fix the issues in the codebase
30
+ - **Tip**: If test failures are related to coverage thresholds and the project uses lcov format, consider using the `brennpunkt` MCP server tools (e.g., `brennpunkt_get_priorities`, `brennpunkt_coverage_summary`) to identify which files need test coverage improvements. Install brennpunkt as an MCP server with: `npx -y -p @redaksjon/brennpunkt brennpunkt-mcp`
31
+ - Commit and push the fixes
32
+ - Simply restart `kodrdriv_publish` - the system will automatically check if a Pull Request exists and resume appropriately
33
+ - **Note**: Single-package publish does not use the `continue` parameter
34
+
35
+ 4. **Handle Release Workflow Errors**
36
+ - If an error occurs while waiting for a Release Workflow:
37
+ - This indicates a more serious problem
38
+ - Ask the user how to proceed
39
+ - The system may be in an inconsistent state that requires manual intervention
40
+
41
+ 5. **Handle Precondition Check Failures**
42
+ - If precondition checks fail (version conflicts, branch state, etc.):
43
+ - Analyze the error message to understand what needs to be fixed
44
+ - Fix the underlying issues
45
+ - Re-run `kodrdriv_publish`
46
+
47
+ ## Error Resolution Strategy
48
+
49
+ ### When Errors Occur
50
+
51
+ 1. **Read the Error Message Carefully**
52
+ - Error messages typically indicate:
53
+ - What type of error occurred
54
+ - Where to look for more information (PR links, file paths, etc.)
55
+
56
+ 2. **Investigate the Root Cause**
57
+ - For GitHub workflow errors: Check the PR/workflow logs
58
+ - For Git errors: Check branch state, conflicts, or merge issues
59
+ - For precondition errors: Check version numbers, branch names, or dependency states
60
+
61
+ 3. **Fix the Issues**
62
+ - Make necessary code changes
63
+ - Fix version conflicts
64
+ - Resolve Git conflicts
65
+ - Update dependencies if needed
66
+
67
+ 4. **Commit and Push**
68
+ - Commit fixes with appropriate messages
69
+ - Push changes to trigger re-validation
70
+
71
+ 5. **Resume Appropriately**
72
+ - Simply restart `kodrdriv_publish` - the system will automatically detect existing PRs and resume appropriately
73
+
74
+ ## Expected End State
75
+
76
+ After a successful publish workflow, the project should end up in a "working" branch with:
77
+ - An incremented version number
78
+ - A dev tag (e.g., `1.2.3-dev.0`)
79
+
80
+ **Note**: This is information for verification purposes. The publish workflow handles versioning automatically - you don't need to manually manage versions or tags.
81
+
82
+ ## Important Notes
83
+
84
+ - **Don't Skip Precommit**: Unless `fix_and_commit` was just run, always verify precommit checks pass before publishing.
85
+ - **Error Links**: When GitHub errors occur, they often provide direct links to PRs or workflows - use these to understand what needs fixing.
86
+ - **Resume Strategy**: Simply restart `kodrdriv_publish` - the system will automatically detect existing PRs and resume appropriately.
87
+
88
+ ## Example Flow
89
+
90
+ ```
91
+ 1. Run kodrdriv_precommit (unless fix_and_commit was just run)
92
+ 2. Run kodrdriv_publish
93
+ → Error: PR validation failed
94
+ → Link provided: https://github.com/org/repo/pull/456
95
+ 3. Investigate PR #456 → Find linting error
96
+ 4. Fix the linting error → Commit and push
97
+ 5. Run kodrdriv_publish again
98
+ → System detects existing PR and resumes appropriately
99
+ 6. Monitor for completion
100
+ ```
@@ -0,0 +1,102 @@
1
+ # Tree Fix and Commit Workflow
2
+
3
+ ## Objective
4
+
5
+ Ensure that precommit checks pass successfully across the entire monorepo tree. When failures occur, understand the root cause, fix the issues, and resume from the point of failure rather than restarting from the beginning.
6
+
7
+ ## Critical: Monorepo Root Directory
8
+
9
+ **IMPORTANT**: The monorepo root directory is `/Users/tobrien/gitw/grunnverk`, NOT `/Users/tobrien/gitw/grunnverk/kodrdriv`.
10
+
11
+ - `kodrdriv` is a subdirectory within the `grunnverk` monorepo
12
+ - All tree commands MUST be run from the grunnverk root: `/Users/tobrien/gitw/grunnverk`
13
+ - Never run tree commands from within the kodrdriv subdirectory
14
+ - The `directory` parameter for all MCP tree commands should be `/Users/tobrien/gitw/grunnverk`
15
+
16
+ ## Workflow Steps
17
+
18
+ 1. **Initial Precommit Check**
19
+ - **ALWAYS use the MCP tool**: Run `kodrdriv_tree_precommit` with `fix=true`, `parallel=true`, and `directory="/Users/tobrien/gitw/grunnverk"`
20
+ - **CRITICAL: Use `parallel=true`** - This dramatically speeds up execution for large monorepos by running independent packages concurrently
21
+ - **DO NOT** fall back to manual command-line execution (`npx kodrdriv tree precommit`) unless the MCP tool is completely broken
22
+ - If the MCP tool fails, investigate the error message carefully - it will tell you which package failed and why
23
+ - This will execute precommit checks (linting, type checking, tests, build) across all packages, respecting dependency order even in parallel mode
24
+
25
+ 2. **Handle Failures**
26
+ - **If the MCP tool fails**: The error message will indicate which package failed (e.g., "Command failed in package @eldrforge/tree-execution")
27
+ - **DO NOT** switch to manual command-line execution - continue using the MCP tool with `start_from` parameter
28
+ - Carefully analyze the error output to understand:
29
+ - Which package failed
30
+ - What type of error occurred (lint error, type error, test failure, build failure)
31
+ - The specific files and lines involved
32
+ - Fix the issues in the failing package:
33
+ - For lint errors: Fix code style issues or disable specific rules with inline comments if justified
34
+ - For type errors: Fix TypeScript type issues
35
+ - For test failures: Update or fix tests to match new behavior
36
+ - For build failures: Fix compilation or bundling issues
37
+ - For coverage drops: Add tests to maintain coverage thresholds
38
+ - **Tip**: If the project uses lcov format for coverage reports and you're struggling with coverage thresholds, consider using the `brennpunkt` MCP server tools (e.g., `brennpunkt_get_priorities`, `brennpunkt_coverage_summary`, `brennpunkt_get_file_coverage`) to identify high-priority files and understand coverage gaps. Install brennpunkt as an MCP server with: `npx -y -p @redaksjon/brennpunkt brennpunkt-mcp`
39
+
40
+ 3. **Resume from Failure Point**
41
+ - After fixing issues, use `start_from` parameter to resume from the package that failed
42
+ - **ALWAYS include `parallel=true`** when resuming - it significantly reduces wait time
43
+ - This avoids re-running checks on packages that already passed, saving significant time in large projects
44
+ - Example: If package `@eldrforge/core` failed, run `kodrdriv_tree_precommit` with `start_from="@eldrforge/core"`, `parallel=true`, and `fix=true`
45
+ - The `start_from` parameter accepts either package name (e.g., `@eldrforge/core`) or directory name (e.g., `core`)
46
+
47
+ 4. **Iterate Until Success**
48
+ - Repeat steps 2-3 until all packages pass precommit checks
49
+ - Each iteration should resume from the last failing package
50
+
51
+ 5. **Commit Changes**
52
+ - Once all precommit checks pass, commit the fixes using `kodrdriv_tree_commit` with `sendit=true`
53
+ - The commit message will be automatically generated from the changes
54
+
55
+ ## Important Notes
56
+
57
+ - **ALWAYS use MCP tools**: Use `kodrdriv_tree_precommit`, `kodrdriv_tree_commit`, etc. - do NOT fall back to manual command-line execution
58
+ - **Monorepo Root**: Always use `directory="/Users/tobrien/gitw/grunnverk"` - kodrdriv is a subdirectory, not the root
59
+ - **Parallel Execution**: **ALWAYS use `parallel=true`** - This is critical for large monorepos as it can reduce execution time from 20-30 minutes to 5-10 minutes by running independent packages concurrently
60
+ - **Efficiency**: For large monorepos, always use `start_from` to resume from failures rather than restarting the entire process
61
+ - **Dependency Order**: The tree commands process packages in dependency order, even in parallel mode - independent packages run concurrently while respecting dependencies
62
+ - **Fix Flag**: Use `fix=true` to enable auto-fixing where possible, but manual fixes may still be required
63
+ - **All Tree Commands Support `start_from`**: The `start_from` parameter works with all tree MCP commands (`kodrdriv_tree_precommit`, `kodrdriv_tree_publish`, `kodrdriv_tree_commit`, etc.)
64
+ - **MCP Tool Failures**: If the MCP tool reports an error, investigate the error message - it contains the package name and failure reason. Continue using the MCP tool with `start_from` and `parallel=true` to resume from the failure point.
65
+
66
+ ## Example Flow
67
+
68
+ ```
69
+ 1. kodrdriv_tree_precommit({
70
+ directory: "/Users/tobrien/gitw/grunnverk",
71
+ fix: true,
72
+ parallel: true // CRITICAL: Speeds up execution significantly
73
+ })
74
+ → Fails at package "@eldrforge/commands-git"
75
+ → Error: "Command failed in package @eldrforge/commands-git"
76
+
77
+ 2. Analyze error: TypeScript type error in src/git.ts:42
78
+ → Fix the type error in the commands-git package
79
+
80
+ 3. kodrdriv_tree_precommit({
81
+ directory: "/Users/tobrien/gitw/grunnverk",
82
+ fix: true,
83
+ parallel: true, // ALWAYS include parallel=true
84
+ start_from: "commands-git" // or "@eldrforge/commands-git"
85
+ })
86
+ → Continues from commands-git, may fail at next package
87
+
88
+ 4. Repeat until all pass (always using MCP tools with parallel=true, never manual commands)
89
+
90
+ 5. kodrdriv_tree_commit({
91
+ directory: "/Users/tobrien/gitw/grunnverk",
92
+ sendit: true
93
+ })
94
+ → Commits all fixes
95
+ ```
96
+
97
+ ## What NOT to Do
98
+
99
+ - ❌ **DO NOT** run `npx kodrdriv tree precommit` manually from the command line
100
+ - ❌ **DO NOT** use `/Users/tobrien/gitw/grunnverk/kodrdriv` as the directory - that's a subdirectory, not the root
101
+ - ❌ **DO NOT** switch to manual execution if the MCP tool fails - investigate the error and use `start_from` to resume
102
+ - ❌ **DO NOT** run commands from within the kodrdriv directory - always use the grunnverk root
@@ -0,0 +1,118 @@
1
+ # Tree Publish Workflow
2
+
3
+ ## Objective
4
+
5
+ Execute a complete publishing workflow for a monorepo tree. Handle errors gracefully, fix issues as they arise, and resume from checkpoints when appropriate.
6
+
7
+ ## Pre-Publish Verification
8
+
9
+ **Important**: Before running `kodrdriv_tree_publish`, verify that `kodrdriv_tree_precommit` works successfully.
10
+
11
+ **CRITICAL: Use `parallel=true`** when running `kodrdriv_tree_precommit` - this dramatically speeds up execution for large monorepos (reduces time from 20-30 minutes to 5-10 minutes).
12
+
13
+ **Exception**: If `tree_fix_and_commit` was just executed successfully, you can skip the precommit check and proceed directly to publish. The `tree_fix_and_commit` workflow already ensures all precommit checks pass.
14
+
15
+ ## Publishing Workflow
16
+
17
+ **CRITICAL: Maintain Tree Publish Context**
18
+
19
+ Once you start a `kodrdriv_tree_publish` operation, you establish a context file that facilitates coordinated version updates across all projects in the monorepo. **DO NOT switch between tree and single-package operations** during a publish workflow.
20
+
21
+ - **If tree publish fails**: Fix the problem at the failing package, then return to the **top-level directory** and run `kodrdriv_tree_publish` with `continue: true`
22
+ - **NEVER switch to `kodrdriv_publish`** in a subproject when recovering from a tree publish failure
23
+ - The context file created by tree publish tracks version coordination across packages - switching to single-package publish breaks this coordination
24
+
25
+ 1. **Run Tree Publish**
26
+ - Execute `kodrdriv_tree_publish` with appropriate parameters
27
+ - If specific packages are provided (${packages}), use the `packages` parameter to target only those packages
28
+ - The command will start generating output as it processes packages in dependency order
29
+ - This creates a context file that tracks version updates across the entire tree
30
+
31
+ 2. **Monitor for Errors**
32
+ - Watch the output carefully for errors
33
+ - Common error sources:
34
+ - **GitHub Actions/Workflows**: Build failures, test failures, or validation errors in Pull Requests
35
+ - **Git Conflicts**: Merge conflicts or branch state issues
36
+ - **Precondition Checks**: Version conflicts, branch state issues, or dependency problems
37
+
38
+ 3. **Handle Pull Request Errors**
39
+ - If an error occurs during Pull Request validation:
40
+ - The error message will typically include a link to the failing PR or workflow
41
+ - Navigate to the provided link and investigate the build/test errors
42
+ - Fix the issues in the codebase
43
+ - **Tip**: If test failures are related to coverage thresholds and the project uses lcov format, consider using the `brennpunkt` MCP server tools (e.g., `brennpunkt_get_priorities`, `brennpunkt_coverage_summary`) to identify which files need test coverage improvements. Install brennpunkt as an MCP server with: `npx -y -p @redaksjon/brennpunkt brennpunkt-mcp`
44
+ - Commit and push the fixes
45
+ - Once the PR starts re-validating, use `kodrdriv_tree_publish` with `continue: true` to resume from the checkpoint
46
+ - **Important**: The `continue` parameter only works during the Pull Request wait phase
47
+
48
+ 4. **Handle Release Workflow Errors**
49
+ - If an error occurs while waiting for a Release Workflow:
50
+ - This indicates a more serious problem
51
+ - **Do NOT attempt to use `continue`** - ask the user how to proceed
52
+ - The system may be in an inconsistent state that requires manual intervention
53
+
54
+ 5. **Handle Precondition Check Failures**
55
+ - If precondition checks fail (version conflicts, branch state, etc.):
56
+ - Analyze the error message to understand what needs to be fixed
57
+ - Fix the underlying issues
58
+ - Re-run `kodrdriv_tree_publish` (you may need to use `continue: true` if a checkpoint exists)
59
+
60
+ ## Error Resolution Strategy
61
+
62
+ ### When Errors Occur
63
+
64
+ 1. **Read the Error Message Carefully**
65
+ - Error messages typically indicate:
66
+ - Which package failed
67
+ - What type of error occurred
68
+ - Where to look for more information (PR links, file paths, etc.)
69
+
70
+ 2. **Investigate the Root Cause**
71
+ - For GitHub workflow errors: Check the PR/workflow logs
72
+ - For Git errors: Check branch state, conflicts, or merge issues
73
+ - For precondition errors: Check version numbers, branch names, or dependency states
74
+
75
+ 3. **Fix the Issues**
76
+ - Make necessary code changes
77
+ - Fix version conflicts
78
+ - Resolve Git conflicts
79
+ - Update dependencies if needed
80
+
81
+ 4. **Commit and Push**
82
+ - Commit fixes with appropriate messages
83
+ - Push changes to trigger re-validation
84
+
85
+ 5. **Resume Appropriately**
86
+ - Return to the **top-level directory** and use `kodrdriv_tree_publish` with `continue: true` during PR wait phase
87
+ - **CRITICAL**: Do NOT switch to `kodrdriv_publish` in a subproject - this breaks the tree publish context
88
+
89
+ ## Expected End State
90
+
91
+ After a successful publish workflow, projects should end up in a "working" branch with:
92
+ - An incremented version number
93
+ - A dev tag (e.g., `1.2.3-dev.0`)
94
+
95
+ **Note**: This is information for verification purposes. The publish workflow handles versioning automatically - you don't need to manually manage versions or tags.
96
+
97
+ ## Important Notes
98
+
99
+ - **Maintain Tree Publish Context**: Once you start `kodrdriv_tree_publish`, you establish a context file that coordinates version updates across projects. If tree publish fails, fix the issue and return to the top-level directory to run `kodrdriv_tree_publish` with `continue: true`. **NEVER switch to `kodrdriv_publish` in a subproject** - this breaks version coordination.
100
+ - **Checkpoint Recovery**: The `continue` parameter only works during Pull Request validation waits. It does NOT work for Release Workflow errors.
101
+ - **Don't Skip Precommit**: Unless `fix_and_commit` was just run, always verify precommit checks pass before publishing.
102
+ - **Error Links**: When GitHub errors occur, they often provide direct links to PRs or workflows - use these to understand what needs fixing.
103
+ - **Resume Strategy**: Use `continue: true` to resume from checkpoints at the **top-level directory**.
104
+
105
+ ## Example Flow
106
+
107
+ ```
108
+ 1. Run kodrdriv_tree_precommit({ parallel: true }) (unless fix_and_commit was just run)
109
+ → Use parallel=true to speed up execution significantly
110
+ 2. Run kodrdriv_tree_publish
111
+ → Error: PR validation failed for @org/package-a
112
+ → Link provided: https://github.com/org/repo/pull/123
113
+ 3. Investigate PR #123 → Find failing test
114
+ 4. Fix the test → Commit and push
115
+ 5. **Return to top-level directory** → Run kodrdriv_tree_publish({ continue: true })
116
+ → Resumes from checkpoint, continues processing with maintained context
117
+ 6. Monitor for additional errors or completion
118
+ ```