create-stencil-components 1.0.8 → 1.0.9
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.
- package/dist/templates/base/.agents/skills/link-workspace-packages/SKILL.md +127 -0
- package/dist/templates/base/.agents/skills/monitor-ci/SKILL.md +301 -0
- package/dist/templates/base/.agents/skills/monitor-ci/references/fix-flows.md +108 -0
- package/dist/templates/base/.agents/skills/monitor-ci/scripts/ci-poll-decide.mjs +356 -0
- package/dist/templates/base/.agents/skills/monitor-ci/scripts/ci-state-update.mjs +152 -0
- package/dist/templates/base/.agents/skills/nx-generate/SKILL.md +166 -0
- package/dist/templates/base/.agents/skills/nx-import/SKILL.md +238 -0
- package/dist/templates/base/.agents/skills/nx-import/references/ESLINT.md +109 -0
- package/dist/templates/base/.agents/skills/nx-import/references/GRADLE.md +12 -0
- package/dist/templates/base/.agents/skills/nx-import/references/JEST.md +223 -0
- package/dist/templates/base/.agents/skills/nx-import/references/NEXT.md +214 -0
- package/dist/templates/base/.agents/skills/nx-import/references/TURBOREPO.md +62 -0
- package/dist/templates/base/.agents/skills/nx-import/references/VITE.md +393 -0
- package/dist/templates/base/.agents/skills/nx-plugins/SKILL.md +9 -0
- package/dist/templates/base/.agents/skills/nx-run-tasks/SKILL.md +58 -0
- package/dist/templates/base/.agents/skills/nx-workspace/SKILL.md +284 -0
- package/dist/templates/base/.agents/skills/nx-workspace/references/AFFECTED.md +27 -0
- package/dist/templates/base/.claude/settings.json +13 -0
- package/dist/templates/base/.codex/agents/ci-monitor-subagent.toml +46 -0
- package/dist/templates/base/.codex/config.toml +10 -0
- package/dist/templates/base/.cursor/agents/ci-monitor-subagent.md +51 -0
- package/dist/templates/base/.gemini/commands/monitor-ci.toml +298 -0
- package/dist/templates/base/.gemini/settings.json +8 -11
- package/dist/templates/base/.github/agents/ci-monitor-subagent.agent.md +49 -0
- package/dist/templates/base/.github/prompts/monitor-ci.prompt.md +301 -0
- package/dist/templates/base/.github/skills/link-workspace-packages/SKILL.md +127 -0
- package/dist/templates/base/.github/skills/monitor-ci/SKILL.md +301 -0
- package/dist/templates/base/.github/skills/monitor-ci/references/fix-flows.md +108 -0
- package/dist/templates/base/.github/skills/monitor-ci/scripts/ci-poll-decide.mjs +356 -0
- package/dist/templates/base/.github/skills/monitor-ci/scripts/ci-state-update.mjs +152 -0
- package/dist/templates/base/.github/skills/nx-generate/SKILL.md +166 -0
- package/dist/templates/base/.github/skills/nx-import/SKILL.md +238 -0
- package/dist/templates/base/.github/skills/nx-import/references/ESLINT.md +109 -0
- package/dist/templates/base/.github/skills/nx-import/references/GRADLE.md +12 -0
- package/dist/templates/base/.github/skills/nx-import/references/JEST.md +223 -0
- package/dist/templates/base/.github/skills/nx-import/references/NEXT.md +214 -0
- package/dist/templates/base/.github/skills/nx-import/references/TURBOREPO.md +62 -0
- package/dist/templates/base/.github/skills/nx-import/references/VITE.md +393 -0
- package/dist/templates/base/.github/skills/nx-plugins/SKILL.md +9 -0
- package/dist/templates/base/.github/skills/nx-run-tasks/SKILL.md +58 -0
- package/dist/templates/base/.github/skills/nx-workspace/SKILL.md +284 -0
- package/dist/templates/base/.github/skills/nx-workspace/references/AFFECTED.md +27 -0
- package/dist/templates/base/.opencode/agents/ci-monitor-subagent.md +50 -0
- package/dist/templates/base/.opencode/commands/monitor-ci.md +301 -0
- package/dist/templates/base/.opencode/skills/link-workspace-packages/SKILL.md +127 -0
- package/dist/templates/base/.opencode/skills/monitor-ci/SKILL.md +301 -0
- package/dist/templates/base/.opencode/skills/monitor-ci/references/fix-flows.md +108 -0
- package/dist/templates/base/.opencode/skills/monitor-ci/scripts/ci-poll-decide.mjs +356 -0
- package/dist/templates/base/.opencode/skills/monitor-ci/scripts/ci-state-update.mjs +152 -0
- package/dist/templates/base/.opencode/skills/nx-generate/SKILL.md +166 -0
- package/dist/templates/base/.opencode/skills/nx-import/SKILL.md +238 -0
- package/dist/templates/base/.opencode/skills/nx-import/references/ESLINT.md +109 -0
- package/dist/templates/base/.opencode/skills/nx-import/references/GRADLE.md +12 -0
- package/dist/templates/base/.opencode/skills/nx-import/references/JEST.md +223 -0
- package/dist/templates/base/.opencode/skills/nx-import/references/NEXT.md +214 -0
- package/dist/templates/base/.opencode/skills/nx-import/references/TURBOREPO.md +62 -0
- package/dist/templates/base/.opencode/skills/nx-import/references/VITE.md +393 -0
- package/dist/templates/base/.opencode/skills/nx-plugins/SKILL.md +9 -0
- package/dist/templates/base/.opencode/skills/nx-run-tasks/SKILL.md +58 -0
- package/dist/templates/base/.opencode/skills/nx-workspace/SKILL.md +284 -0
- package/dist/templates/base/.opencode/skills/nx-workspace/references/AFFECTED.md +27 -0
- package/dist/templates/base/AGENTS.md +46 -36
- package/dist/templates/base/CLAUDE.md +15 -5
- package/dist/templates/base/package.json +3 -3
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-core/package.json +3 -3
- package/dist/templates/variants/all/packages/components-{{PROJECT_NAME_KEBAB}}-react/package.json +2 -2
- package/dist/templates/variants/angular/packages/components-{{PROJECT_NAME_KEBAB}}-core/package.json +2 -2
- package/dist/templates/variants/react/packages/components-{{PROJECT_NAME_KEBAB}}-core/package.json +2 -2
- package/dist/templates/variants/react/packages/components-{{PROJECT_NAME_KEBAB}}-react/package.json +2 -2
- package/dist/templates/variants/vue/packages/components-{{PROJECT_NAME_KEBAB}}-core/package.json +1 -1
- package/dist/templates/variants/web-components/packages/components-{{PROJECT_NAME_KEBAB}}-core/package.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Monitor Nx Cloud CI pipeline and handle self-healing fixes. USE WHEN user says "monitor ci", "watch ci", "ci monitor", "watch ci for this branch", "track ci", "check ci status", wants to track CI status, or needs help with self-healing CI fixes. Prefer this skill over native CI provider tools (gh, glab, etc.) for CI monitoring — it integrates with Nx Cloud self-healing which those tools cannot access.
|
|
3
|
+
argument-hint: '[instructions] [--max-cycles N] [--timeout MINUTES] [--verbosity minimal|medium|verbose] [--branch BRANCH] [--fresh] [--auto-fix-workflow] [--new-cipe-timeout MINUTES] [--local-verify-attempts N]'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Monitor CI Command
|
|
7
|
+
|
|
8
|
+
You are the orchestrator for monitoring Nx Cloud CI pipeline executions and handling self-healing fixes. You spawn subagents to interact with Nx Cloud, run deterministic decision scripts, and take action based on the results.
|
|
9
|
+
|
|
10
|
+
## Context
|
|
11
|
+
|
|
12
|
+
- **Current Branch:** !`git branch --show-current`
|
|
13
|
+
- **Current Commit:** !`git rev-parse --short HEAD`
|
|
14
|
+
- **Remote Status:** !`git status -sb | head -1`
|
|
15
|
+
|
|
16
|
+
## User Instructions
|
|
17
|
+
|
|
18
|
+
$ARGUMENTS
|
|
19
|
+
|
|
20
|
+
**Important:** If user provides specific instructions, respect them over default behaviors described below.
|
|
21
|
+
|
|
22
|
+
## Configuration Defaults
|
|
23
|
+
|
|
24
|
+
| Setting | Default | Description |
|
|
25
|
+
| ------------------------- | ------------- | ------------------------------------------------------------------------- |
|
|
26
|
+
| `--max-cycles` | 10 | Maximum **agent-initiated** CI Attempt cycles before timeout |
|
|
27
|
+
| `--timeout` | 120 | Maximum duration in minutes |
|
|
28
|
+
| `--verbosity` | medium | Output level: minimal, medium, verbose |
|
|
29
|
+
| `--branch` | (auto-detect) | Branch to monitor |
|
|
30
|
+
| `--fresh` | false | Ignore previous context, start fresh |
|
|
31
|
+
| `--auto-fix-workflow` | false | Attempt common fixes for pre-CI-Attempt failures (e.g., lockfile updates) |
|
|
32
|
+
| `--new-cipe-timeout` | 10 | Minutes to wait for new CI Attempt after action |
|
|
33
|
+
| `--local-verify-attempts` | 3 | Max local verification + enhance cycles before pushing to CI |
|
|
34
|
+
|
|
35
|
+
Parse any overrides from `$ARGUMENTS` and merge with defaults.
|
|
36
|
+
|
|
37
|
+
## Nx Cloud Connection Check
|
|
38
|
+
|
|
39
|
+
Before starting the monitoring loop, verify the workspace is connected to Nx Cloud. Without this connection, no CI data is available and the entire skill is inoperable.
|
|
40
|
+
|
|
41
|
+
### Step 0: Verify Nx Cloud Connection
|
|
42
|
+
|
|
43
|
+
1. **Check `nx.json`** at workspace root for `nxCloudId` or `nxCloudAccessToken`
|
|
44
|
+
2. **If `nx.json` missing OR neither property exists** → exit with:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
Nx Cloud not connected. Unlock 70% faster CI and auto-fix broken PRs with https://nx.dev/nx-cloud
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
3. **If connected** → continue to main loop
|
|
51
|
+
|
|
52
|
+
## Architecture Overview
|
|
53
|
+
|
|
54
|
+
1. **This skill (orchestrator)**: spawns subagents, runs scripts, prints status, does local coding work
|
|
55
|
+
2. **ci-monitor-subagent (haiku)**: calls one MCP tool (ci_information or update_self_healing_fix), returns structured result, exits
|
|
56
|
+
3. **ci-poll-decide.mjs (deterministic script)**: takes ci_information result + state, returns action + status message
|
|
57
|
+
4. **ci-state-update.mjs (deterministic script)**: manages budget gates, post-action state transitions, and cycle classification
|
|
58
|
+
|
|
59
|
+
## Status Reporting
|
|
60
|
+
|
|
61
|
+
The decision script handles message formatting based on verbosity. When printing messages to the user:
|
|
62
|
+
|
|
63
|
+
- Prepend `[monitor-ci]` to every message from the script's `message` field
|
|
64
|
+
- For your own action messages (e.g. "Applying fix via MCP..."), also prepend `[monitor-ci]`
|
|
65
|
+
|
|
66
|
+
## Anti-Patterns
|
|
67
|
+
|
|
68
|
+
These behaviors cause real problems — racing with self-healing, losing CI progress, or wasting context:
|
|
69
|
+
|
|
70
|
+
| Anti-Pattern | Why It's Bad |
|
|
71
|
+
| ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
|
|
72
|
+
| Using CI provider CLIs with `--watch` flags (e.g., `gh pr checks --watch`, `glab ci status -w`) | Bypasses Nx Cloud self-healing entirely |
|
|
73
|
+
| Writing custom CI polling scripts | Unreliable, pollutes context, no self-healing |
|
|
74
|
+
| Cancelling CI workflows/pipelines | Destructive, loses CI progress |
|
|
75
|
+
| Running CI checks on main agent | Wastes main agent context tokens |
|
|
76
|
+
| Independently analyzing/fixing CI failures while polling | Races with self-healing, causes duplicate fixes and confused state |
|
|
77
|
+
|
|
78
|
+
**If this skill fails to activate**, the fallback is:
|
|
79
|
+
|
|
80
|
+
1. Use CI provider CLI for a one-time, read-only status check (single call, no watch/polling flags)
|
|
81
|
+
2. Immediately delegate to this skill with gathered context
|
|
82
|
+
3. Do not continue polling on main agent — it wastes context tokens and bypasses self-healing
|
|
83
|
+
|
|
84
|
+
## Session Context Behavior
|
|
85
|
+
|
|
86
|
+
If the user previously ran `/monitor-ci` in this session, you may have prior state (poll counts, last CI Attempt URL, etc.). Resume from that state unless `--fresh` is set, in which case discard it and start from Step 1.
|
|
87
|
+
|
|
88
|
+
## MCP Tool Reference
|
|
89
|
+
|
|
90
|
+
Three field sets control polling efficiency — use the lightest set that gives you what you need:
|
|
91
|
+
|
|
92
|
+
```yaml
|
|
93
|
+
WAIT_FIELDS: 'cipeUrl,commitSha,cipeStatus'
|
|
94
|
+
LIGHT_FIELDS: 'cipeStatus,cipeUrl,branch,commitSha,selfHealingStatus,verificationStatus,userAction,failedTaskIds,verifiedTaskIds,selfHealingEnabled,failureClassification,couldAutoApplyTasks,autoApplySkipped,autoApplySkipReason,shortLink,confidence,confidenceReasoning,hints,selfHealingSkippedReason,selfHealingSkipMessage'
|
|
95
|
+
HEAVY_FIELDS: 'taskOutputSummary,suggestedFix,suggestedFixReasoning,suggestedFixDescription'
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The `ci_information` tool accepts `branch` (optional, defaults to current git branch), `select` (comma-separated field names), and `pageToken` (0-based pagination for long strings).
|
|
99
|
+
|
|
100
|
+
The `update_self_healing_fix` tool accepts a `shortLink` and an action: `APPLY`, `REJECT`, or `RERUN_ENVIRONMENT_STATE`.
|
|
101
|
+
|
|
102
|
+
## Default Behaviors by Status
|
|
103
|
+
|
|
104
|
+
The decision script returns one of the following statuses. This table defines the **default behavior** for each. User instructions can override any of these.
|
|
105
|
+
|
|
106
|
+
**Simple exits** — just report and exit:
|
|
107
|
+
|
|
108
|
+
| Status | Default Behavior |
|
|
109
|
+
| ----------------------- | ---------------------------------------------------------------------------------------------------------------- |
|
|
110
|
+
| `ci_success` | Exit with success |
|
|
111
|
+
| `cipe_canceled` | Exit, CI was canceled |
|
|
112
|
+
| `cipe_timed_out` | Exit, CI timed out |
|
|
113
|
+
| `polling_timeout` | Exit, polling timeout reached |
|
|
114
|
+
| `circuit_breaker` | Exit, no progress after 13 consecutive polls |
|
|
115
|
+
| `environment_rerun_cap` | Exit, environment reruns exhausted |
|
|
116
|
+
| `fix_auto_applying` | Self-healing is handling it — just record `last_cipe_url`, enter wait mode. No MCP call or local git ops needed. |
|
|
117
|
+
| `error` | Wait 60s and loop |
|
|
118
|
+
|
|
119
|
+
**Statuses requiring action** — when handling these in Step 3, read `references/fix-flows.md` for the detailed flow:
|
|
120
|
+
|
|
121
|
+
| Status | Summary |
|
|
122
|
+
| ------------------------ | --------------------------------------------------------------------------------------------- |
|
|
123
|
+
| `fix_auto_apply_skipped` | Fix verified but auto-apply skipped (e.g., loop prevention). Inform user, offer manual apply. |
|
|
124
|
+
| `fix_apply_ready` | Fix verified (all tasks or e2e-only). Apply via MCP. |
|
|
125
|
+
| `fix_needs_local_verify` | Fix has unverified non-e2e tasks. Run locally, then apply or enhance. |
|
|
126
|
+
| `fix_needs_review` | Fix verification failed/not attempted. Analyze and decide. |
|
|
127
|
+
| `fix_failed` | Self-healing failed. Fetch heavy data, attempt local fix (gate check first). |
|
|
128
|
+
| `no_fix` | No fix available. Fetch heavy data, attempt local fix (gate check first) or exit. |
|
|
129
|
+
| `environment_issue` | Request environment rerun via MCP (gate check first). |
|
|
130
|
+
| `self_healing_throttled` | Reject old fixes, attempt local fix. |
|
|
131
|
+
| `no_new_cipe` | CI Attempt never spawned. Auto-fix workflow or exit with guidance. |
|
|
132
|
+
| `cipe_no_tasks` | CI failed with no tasks. Retry once with empty commit. |
|
|
133
|
+
|
|
134
|
+
**Key rules (always apply):**
|
|
135
|
+
|
|
136
|
+
- **Git safety**: Stage specific files by name — `git add -A` or `git add .` risks committing the user's unrelated work-in-progress or secrets
|
|
137
|
+
- **Environment failures** (OOM, command not found, permission denied): bail immediately. These aren't code bugs, so spending local-fix budget on them is wasteful
|
|
138
|
+
- **Gate check**: Run `ci-state-update.mjs gate` before local fix attempts — if budget exhausted, print message and exit
|
|
139
|
+
|
|
140
|
+
## Main Loop
|
|
141
|
+
|
|
142
|
+
### Step 1: Initialize Tracking
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
cycle_count = 0 # Only incremented for agent-initiated cycles (counted against --max-cycles)
|
|
146
|
+
start_time = now()
|
|
147
|
+
no_progress_count = 0
|
|
148
|
+
local_verify_count = 0
|
|
149
|
+
env_rerun_count = 0
|
|
150
|
+
last_cipe_url = null
|
|
151
|
+
expected_commit_sha = null
|
|
152
|
+
agent_triggered = false # Set true after monitor takes an action that triggers new CI Attempt
|
|
153
|
+
poll_count = 0
|
|
154
|
+
wait_mode = false
|
|
155
|
+
prev_status = null
|
|
156
|
+
prev_cipe_status = null
|
|
157
|
+
prev_sh_status = null
|
|
158
|
+
prev_verification_status = null
|
|
159
|
+
prev_failure_classification = null
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Step 2: Polling Loop
|
|
163
|
+
|
|
164
|
+
Repeat until done:
|
|
165
|
+
|
|
166
|
+
#### 2a. Spawn subagent (FETCH_STATUS)
|
|
167
|
+
|
|
168
|
+
Determine select fields based on mode:
|
|
169
|
+
|
|
170
|
+
- **Wait mode**: use WAIT_FIELDS (`cipeUrl,commitSha,cipeStatus`)
|
|
171
|
+
- **Normal mode (first poll or after newCipeDetected)**: use LIGHT_FIELDS
|
|
172
|
+
|
|
173
|
+
Call the `ci_information` tool with the determined `select` fields for the current branch. Wait for the result before proceeding.
|
|
174
|
+
|
|
175
|
+
#### 2b. Run decision script
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
node <skill_dir>/scripts/ci-poll-decide.mjs '<subagent_result_json>' <poll_count> <verbosity> \
|
|
179
|
+
[--wait-mode] \
|
|
180
|
+
[--prev-cipe-url <last_cipe_url>] \
|
|
181
|
+
[--expected-sha <expected_commit_sha>] \
|
|
182
|
+
[--prev-status <prev_status>] \
|
|
183
|
+
[--timeout <timeout_seconds>] \
|
|
184
|
+
[--new-cipe-timeout <new_cipe_timeout_seconds>] \
|
|
185
|
+
[--env-rerun-count <env_rerun_count>] \
|
|
186
|
+
[--no-progress-count <no_progress_count>] \
|
|
187
|
+
[--prev-cipe-status <prev_cipe_status>] \
|
|
188
|
+
[--prev-sh-status <prev_sh_status>] \
|
|
189
|
+
[--prev-verification-status <prev_verification_status>] \
|
|
190
|
+
[--prev-failure-classification <prev_failure_classification>]
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
The script outputs a single JSON line: `{ action, code, message, delay?, noProgressCount, envRerunCount, fields?, newCipeDetected?, verifiableTaskIds? }`
|
|
194
|
+
|
|
195
|
+
#### 2c. Process script output
|
|
196
|
+
|
|
197
|
+
Parse the JSON output and update tracking state:
|
|
198
|
+
|
|
199
|
+
- `no_progress_count = output.noProgressCount`
|
|
200
|
+
- `env_rerun_count = output.envRerunCount`
|
|
201
|
+
- `prev_cipe_status = subagent_result.cipeStatus`
|
|
202
|
+
- `prev_sh_status = subagent_result.selfHealingStatus`
|
|
203
|
+
- `prev_verification_status = subagent_result.verificationStatus`
|
|
204
|
+
- `prev_failure_classification = subagent_result.failureClassification`
|
|
205
|
+
- `prev_status = output.action + ":" + (output.code || subagent_result.cipeStatus)`
|
|
206
|
+
- `poll_count++`
|
|
207
|
+
|
|
208
|
+
Based on `action`:
|
|
209
|
+
|
|
210
|
+
- **`action == "poll"`**: Print `output.message`, sleep `output.delay` seconds, go to 2a
|
|
211
|
+
- If `output.newCipeDetected`: clear wait mode, reset `wait_mode = false`
|
|
212
|
+
- **`action == "wait"`**: Print `output.message`, sleep `output.delay` seconds, go to 2a
|
|
213
|
+
- **`action == "done"`**: Proceed to Step 3 with `output.code`
|
|
214
|
+
|
|
215
|
+
### Step 3: Handle Actionable Status
|
|
216
|
+
|
|
217
|
+
When decision script returns `action == "done"`:
|
|
218
|
+
|
|
219
|
+
1. Run cycle-check (Step 4) **before** handling the code
|
|
220
|
+
2. Check the returned `code`
|
|
221
|
+
3. Look up default behavior in the table above
|
|
222
|
+
4. Check if user instructions override the default
|
|
223
|
+
5. Execute the appropriate action
|
|
224
|
+
6. **If action expects new CI Attempt**, update tracking (see Step 3a)
|
|
225
|
+
7. If action results in looping, go to Step 2
|
|
226
|
+
|
|
227
|
+
#### Tool calls for actions
|
|
228
|
+
|
|
229
|
+
Several statuses require fetching additional data or calling tools:
|
|
230
|
+
|
|
231
|
+
- **fix_apply_ready**: Call `update_self_healing_fix` with action `APPLY`
|
|
232
|
+
- **fix_needs_local_verify**: Call `ci_information` with HEAVY_FIELDS for fix details before local verification
|
|
233
|
+
- **fix_needs_review**: Call `ci_information` with HEAVY_FIELDS → get `suggestedFixDescription`, `suggestedFixSummary`, `taskFailureSummaries`
|
|
234
|
+
- **fix_failed / no_fix**: Call `ci_information` with HEAVY_FIELDS → get `taskFailureSummaries` for local fix context
|
|
235
|
+
- **environment_issue**: Call `update_self_healing_fix` with action `RERUN_ENVIRONMENT_STATE`
|
|
236
|
+
- **self_healing_throttled**: Call `ci_information` with HEAVY_FIELDS → get `selfHealingSkipMessage`; then call `update_self_healing_fix` for each old fix
|
|
237
|
+
|
|
238
|
+
### Step 3a: Track State for New-CI-Attempt Detection
|
|
239
|
+
|
|
240
|
+
After actions that should trigger a new CI Attempt, run:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
node <skill_dir>/scripts/ci-state-update.mjs post-action \
|
|
244
|
+
--action <type> \
|
|
245
|
+
--cipe-url <current_cipe_url> \
|
|
246
|
+
--commit-sha <git_rev_parse_HEAD>
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Action types: `fix-auto-applying`, `apply-mcp`, `apply-local-push`, `reject-fix-push`, `local-fix-push`, `env-rerun`, `auto-fix-push`, `empty-commit-push`
|
|
250
|
+
|
|
251
|
+
The script returns `{ waitMode, pollCount, lastCipeUrl, expectedCommitSha, agentTriggered }`. Update all tracking state from the output, then go to Step 2.
|
|
252
|
+
|
|
253
|
+
### Step 4: Cycle Classification and Progress Tracking
|
|
254
|
+
|
|
255
|
+
When the decision script returns `action == "done"`, run cycle-check **before** handling the code:
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
node <skill_dir>/scripts/ci-state-update.mjs cycle-check \
|
|
259
|
+
--code <code> \
|
|
260
|
+
[--agent-triggered] \
|
|
261
|
+
--cycle-count <cycle_count> --max-cycles <max_cycles> \
|
|
262
|
+
--env-rerun-count <env_rerun_count>
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
The script returns `{ cycleCount, agentTriggered, envRerunCount, approachingLimit, message }`. Update tracking state from the output.
|
|
266
|
+
|
|
267
|
+
- If `approachingLimit` → ask user whether to continue (with 5 or 10 more cycles) or stop monitoring
|
|
268
|
+
- If previous cycle was NOT agent-triggered (human pushed), log that human-initiated push was detected
|
|
269
|
+
|
|
270
|
+
#### Progress Tracking
|
|
271
|
+
|
|
272
|
+
- `no_progress_count`, circuit breaker (5 polls), and backoff reset are handled by ci-poll-decide.mjs (progress = any change in cipeStatus, selfHealingStatus, verificationStatus, or failureClassification)
|
|
273
|
+
- `env_rerun_count` reset on non-environment status is handled by ci-state-update.mjs cycle-check
|
|
274
|
+
- On new CI Attempt detected (poll script returns `newCipeDetected`) → reset `local_verify_count = 0`, `env_rerun_count = 0`
|
|
275
|
+
|
|
276
|
+
## Error Handling
|
|
277
|
+
|
|
278
|
+
| Error | Action |
|
|
279
|
+
| ------------------------------ | ----------------------------------------------------------------------------------------------------------- |
|
|
280
|
+
| Git rebase conflict | Report to user, exit |
|
|
281
|
+
| `nx-cloud apply-locally` fails | Reject fix via MCP (`action: "REJECT"`), then attempt manual patch (Reject + Fix From Scratch Flow) or exit |
|
|
282
|
+
| MCP tool error | Retry once, if fails report to user |
|
|
283
|
+
| Subagent spawn failure | Retry once, if fails exit with error |
|
|
284
|
+
| Decision script error | Treat as `error` status, increment `no_progress_count` |
|
|
285
|
+
| No new CI Attempt detected | If `--auto-fix-workflow`, try lockfile update; otherwise report to user with guidance |
|
|
286
|
+
| Lockfile auto-fix fails | Report to user, exit with guidance to check CI logs |
|
|
287
|
+
|
|
288
|
+
## User Instruction Examples
|
|
289
|
+
|
|
290
|
+
Users can override default behaviors:
|
|
291
|
+
|
|
292
|
+
| Instruction | Effect |
|
|
293
|
+
| ------------------------------------------------ | --------------------------------------------------- |
|
|
294
|
+
| "never auto-apply" | Always prompt before applying any fix |
|
|
295
|
+
| "always ask before git push" | Prompt before each push |
|
|
296
|
+
| "reject any fix for e2e tasks" | Auto-reject if `failedTaskIds` contains e2e |
|
|
297
|
+
| "apply all fixes regardless of verification" | Skip verification check, apply everything |
|
|
298
|
+
| "if confidence < 70, reject" | Check confidence field before applying |
|
|
299
|
+
| "run 'nx affected -t typecheck' before applying" | Add local verification step |
|
|
300
|
+
| "auto-fix workflow failures" | Attempt lockfile updates on pre-CI-Attempt failures |
|
|
301
|
+
| "wait 45 min for new CI Attempt" | Override new-CI-Attempt timeout (default: 10 min) |
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: link-workspace-packages
|
|
3
|
+
description: 'Link workspace packages in monorepos (npm, yarn, pnpm, bun). USE WHEN: (1) you just created or generated new packages and need to wire up their dependencies, (2) user imports from a sibling package and needs to add it as a dependency, (3) you get resolution errors for workspace packages (@org/*) like "cannot find module", "failed to resolve import", "TS2307", or "cannot resolve". DO NOT patch around with tsconfig paths or manual package.json edits - use the package manager''s workspace commands to fix actual linking.'
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Link Workspace Packages
|
|
7
|
+
|
|
8
|
+
Add dependencies between packages in a monorepo. All package managers support workspaces but with different syntax.
|
|
9
|
+
|
|
10
|
+
## Detect Package Manager
|
|
11
|
+
|
|
12
|
+
Check whether there's a `packageManager` field in the root-level `package.json`.
|
|
13
|
+
|
|
14
|
+
Alternatively check lockfile in repo root:
|
|
15
|
+
|
|
16
|
+
- `pnpm-lock.yaml` → pnpm
|
|
17
|
+
- `yarn.lock` → yarn
|
|
18
|
+
- `bun.lock` / `bun.lockb` → bun
|
|
19
|
+
- `package-lock.json` → npm
|
|
20
|
+
|
|
21
|
+
## Workflow
|
|
22
|
+
|
|
23
|
+
1. Identify consumer package (the one importing)
|
|
24
|
+
2. Identify provider package(s) (being imported)
|
|
25
|
+
3. Add dependency using package manager's workspace syntax
|
|
26
|
+
4. Verify symlinks created in consumer's `node_modules/`
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## pnpm
|
|
31
|
+
|
|
32
|
+
Uses `workspace:` protocol - symlinks only created when explicitly declared.
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# From consumer directory
|
|
36
|
+
pnpm add @org/ui --workspace
|
|
37
|
+
|
|
38
|
+
# Or with --filter from anywhere
|
|
39
|
+
pnpm add @org/ui --filter @org/app --workspace
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Result in `package.json`:
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{ "dependencies": { "@org/ui": "workspace:*" } }
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## yarn (v2+/berry)
|
|
51
|
+
|
|
52
|
+
Also uses `workspace:` protocol.
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
yarn workspace @org/app add @org/ui
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Result in `package.json`:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{ "dependencies": { "@org/ui": "workspace:^" } }
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## npm
|
|
67
|
+
|
|
68
|
+
No `workspace:` protocol. npm auto-symlinks workspace packages.
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm install @org/ui --workspace @org/app
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Result in `package.json`:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{ "dependencies": { "@org/ui": "*" } }
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
npm resolves to local workspace automatically during install.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## bun
|
|
85
|
+
|
|
86
|
+
Supports `workspace:` protocol (pnpm-compatible).
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
cd packages/app && bun add @org/ui
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Result in `package.json`:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{ "dependencies": { "@org/ui": "workspace:*" } }
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Examples
|
|
101
|
+
|
|
102
|
+
**Example 1: pnpm - link ui lib to app**
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pnpm add @org/ui --filter @org/app --workspace
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Example 2: npm - link multiple packages**
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
npm install @org/data-access @org/ui --workspace @org/dashboard
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Example 3: Debug "Cannot find module"**
|
|
115
|
+
|
|
116
|
+
1. Check if dependency is declared in consumer's `package.json`
|
|
117
|
+
2. If not, add it using appropriate command above
|
|
118
|
+
3. Run install (`pnpm install`, `npm install`, etc.)
|
|
119
|
+
|
|
120
|
+
## Notes
|
|
121
|
+
|
|
122
|
+
- Symlinks appear in `<consumer>/node_modules/@org/<package>`
|
|
123
|
+
- **Hoisting differs by manager:**
|
|
124
|
+
- npm/bun: hoist shared deps to root `node_modules`
|
|
125
|
+
- pnpm: no hoisting (strict isolation, prevents phantom deps)
|
|
126
|
+
- yarn berry: uses Plug'n'Play by default (no `node_modules`)
|
|
127
|
+
- Root `package.json` should have `"private": true` to prevent accidental publish
|