@webpieces/rules-config 0.3.222 → 0.3.224
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/rules-config",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.224",
|
|
4
4
|
"description": "Shared webpieces.config.json loader. Single source of truth for validation rule configuration consumed by @webpieces/ai-hook-rules, @webpieces/code-rules, and @webpieces/nx-webpieces-rules.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# webpieces Git & PR Workflow (for the AI)
|
|
2
|
+
|
|
3
|
+
Generated by `@webpieces/pr-gate` (refreshed on every `wp-*` PR/merge command, so it can't drift).
|
|
4
|
+
Read this before running any `wp-git-update` / `wp-start-upsert-pr` / `wp-finish-upsert-pr`.
|
|
5
|
+
|
|
6
|
+
## Golden rule: the tooling NEVER commits your work for you
|
|
7
|
+
|
|
8
|
+
Before running any `wp-*` PR/merge command, your working tree must be 100% clean:
|
|
9
|
+
|
|
10
|
+
- **Commit** every changed tracked file.
|
|
11
|
+
- **Add + commit, or delete** every untracked file.
|
|
12
|
+
|
|
13
|
+
Each command runs `git status --porcelain` first and **aborts** if anything is uncommitted — including
|
|
14
|
+
**untracked** files (gitignored paths like `.webpieces/` are excluded). The tooling deliberately does
|
|
15
|
+
**not** `git add -A` your tree: a blanket sweep once committed a stale untracked directory into a
|
|
16
|
+
squash commit. If a command tells you the tree is dirty, commit or delete the listed files, then re-run.
|
|
17
|
+
|
|
18
|
+
## The 3-point fork-point system
|
|
19
|
+
|
|
20
|
+
- **A = fork point**: `git merge-base origin/main HEAD`
|
|
21
|
+
- **B = feature HEAD**: your branch tip
|
|
22
|
+
- **C = main HEAD**: `origin/main`
|
|
23
|
+
|
|
24
|
+
Never `git merge` or `git rebase` main into your branch directly — it breaks the fork point (A) that
|
|
25
|
+
produces clean PR diffs. Sync only via `pnpm wp-git-update` (a 3-point squash-update). This is enforced
|
|
26
|
+
by the `redirect-how-to-merge-main` guard.
|
|
27
|
+
|
|
28
|
+
## Commands
|
|
29
|
+
|
|
30
|
+
1. **`pnpm wp-git-update`** — squash-update your branch from main. Clean merge → finalizes. Conflicts →
|
|
31
|
+
writes `.webpieces/instruct-ai/webpieces.mergeprocess.md` and hands resolution to you; finish with
|
|
32
|
+
`pnpm wp-finish-upsert-pr`.
|
|
33
|
+
2. **`pnpm wp-start-upsert-pr`** — update from main, push, run an advisory build gate, then tells you to
|
|
34
|
+
write `review.json`. Never creates the PR itself.
|
|
35
|
+
3. **`pnpm wp-finish-upsert-pr`** — validates any in-progress merge, requires your `review.json`, runs
|
|
36
|
+
the **authoritative** build gate, pushes, and creates/updates the PR.
|
|
37
|
+
|
|
38
|
+
## Two possible outcomes of a squash-update
|
|
39
|
+
|
|
40
|
+
A `wp-git-update` (the squash step inside `wp-start-upsert-pr` too) ends one of two ways. The tool
|
|
41
|
+
`git merge --squash`es your feature onto a fresh copy of main; whether that merges cleanly decides
|
|
42
|
+
who does the work.
|
|
43
|
+
|
|
44
|
+
### Outcome A — CLEAN merge (the tool does everything; you do nothing)
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
you: pnpm wp-git-update
|
|
48
|
+
tool: assertCleanTree # you must have committed your own work first
|
|
49
|
+
tool: backup branch; checkout main; pull; create <feature>Squash off main
|
|
50
|
+
tool: git merge --squash <feature> # SUCCEEDS — stages the combined result
|
|
51
|
+
tool: git commit -m "Squash merge of <feature>" # <-- the TOOL commits (mechanical)
|
|
52
|
+
tool: delete old branch; force-push to the stable base; rename to next generation
|
|
53
|
+
done — no AI/human merge work.
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
There is **no `git add` here** — `git merge --squash` staged only the merge result, and the tool
|
|
57
|
+
commits exactly that. The commit is a pure function of your already-committed work + main.
|
|
58
|
+
|
|
59
|
+
### Outcome B — CONFLICT merge (the AI resolves; the tool still commits)
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
you: pnpm wp-git-update
|
|
63
|
+
tool: assertCleanTree; backup; checkout main; pull; create <feature>Squash
|
|
64
|
+
tool: git merge --squash <feature> # CONFLICTS — conflicted files left with markers
|
|
65
|
+
tool: writes .webpieces/merge-info/<feature>/ (A=fork / B=feature / C=main context + diffs)
|
|
66
|
+
tool: writes .webpieces/instruct-ai/webpieces.mergeprocess.md, then exits (code 2)
|
|
67
|
+
---- hand-off to the AI ----
|
|
68
|
+
AI: read webpieces.mergeprocess.md
|
|
69
|
+
AI: per conflicted file -> resolve markers -> git add <file> -> write merge-explanation.md
|
|
70
|
+
AI: pnpm wp-finish-upsert-pr
|
|
71
|
+
tool: validateResolution (no markers left, every file has an explanation)
|
|
72
|
+
tool: assertNoUntracked -> git add -u -> git commit "... (conflicts resolved)" # <-- TOOL commits
|
|
73
|
+
tool: build gate -> push -> create/update PR
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Who does what on the conflict path:
|
|
77
|
+
- **You/the AI** supply the *judgment*: how to combine the conflicting changes. You edit the files,
|
|
78
|
+
`git add` them, and write each `merge-explanation.md`.
|
|
79
|
+
- **The tool** still makes the *commit*. You are BLOCKED from `git commit` / `git push` / `gh pr`
|
|
80
|
+
while the merge is in progress (the `merge-in-progress-guard`); `wp-finish-upsert-pr` is what
|
|
81
|
+
validates and commits. `git add -u` stages only your tracked resolutions and **refuses** if any
|
|
82
|
+
untracked file is present — commit or delete those first, the tool will not sweep them in.
|
|
83
|
+
|
|
84
|
+
The two docs cooperate: **this file** is the always-present overview of both paths;
|
|
85
|
+
**`webpieces.mergeprocess.md`** is written *only when there is a conflict* and lists the exact files
|
|
86
|
+
to resolve for that specific merge.
|
|
87
|
+
|
|
88
|
+
## Before you trust a push
|
|
89
|
+
|
|
90
|
+
The build gate validates the **working tree**; the push sends **HEAD**. A green build on disk does
|
|
91
|
+
**not** mean the committed tree is correct. After any fix, run `git show --stat HEAD` (or `git status`)
|
|
92
|
+
and confirm the commit actually contains your fix. The clean-tree guard enforces `working tree == HEAD`
|
|
93
|
+
before the build gate and push, so a fix left uncommitted will block the PR instead of silently pushing
|
|
94
|
+
a stale commit.
|