@webpieces/rules-config 0.4.985 → 0.4.986
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 +5 -5
- package/src/commands-config.d.ts +1 -1
- package/src/commands-config.js +1 -1
- package/src/commands-config.js.map +1 -1
- package/src/commands-section-validators.js +1 -1
- package/src/commands-section-validators.js.map +1 -1
- package/src/sync-flow-guidance.js +3 -2
- package/src/sync-flow-guidance.js.map +1 -1
- package/templates/webpieces.config-policy.md +10 -4
- package/templates/webpieces.git-workflow.md +35 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/rules-config",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.986",
|
|
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",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"inversify": "7.10.4",
|
|
20
20
|
"reflect-metadata": "0.2.2",
|
|
21
21
|
"minimatch": "10.0.1",
|
|
22
|
-
"@webpieces/tooling-common": "0.4.
|
|
23
|
-
"@webpieces/repo-workflow-core": "0.4.
|
|
24
|
-
"@webpieces/rules-sdk": "0.4.
|
|
22
|
+
"@webpieces/tooling-common": "0.4.986",
|
|
23
|
+
"@webpieces/repo-workflow-core": "0.4.986",
|
|
24
|
+
"@webpieces/rules-sdk": "0.4.986"
|
|
25
25
|
},
|
|
26
26
|
"author": "Dean Hiller",
|
|
27
27
|
"license": "Apache-2.0",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@webpieces/tooling-testkit": "0.4.
|
|
37
|
+
"@webpieces/tooling-testkit": "0.4.986"
|
|
38
38
|
},
|
|
39
39
|
"types": "./src/index.d.ts",
|
|
40
40
|
"bin": {
|
package/src/commands-config.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare const DEFAULT_MERGE_COMPLETE_COMMAND = "pnpm wp-finish-upsert-pr"
|
|
|
11
11
|
* has nothing to configure here.
|
|
12
12
|
*/
|
|
13
13
|
export declare class PushDevConfig {
|
|
14
|
-
/** The dev-scoped build, e.g. `pnpm nx affected
|
|
14
|
+
/** The dev-scoped build, e.g. `pnpm nx affected -t build test --base=origin/dev --head=HEAD`. */
|
|
15
15
|
buildCommand: string | undefined;
|
|
16
16
|
constructor(buildCommand: string | undefined);
|
|
17
17
|
}
|
package/src/commands-config.js
CHANGED
|
@@ -23,7 +23,7 @@ exports.DEFAULT_MERGE_COMPLETE_COMMAND = 'pnpm wp-finish-upsert-pr';
|
|
|
23
23
|
* has nothing to configure here.
|
|
24
24
|
*/
|
|
25
25
|
class PushDevConfig {
|
|
26
|
-
/** The dev-scoped build, e.g. `pnpm nx affected
|
|
26
|
+
/** The dev-scoped build, e.g. `pnpm nx affected -t build test --base=origin/dev --head=HEAD`. */
|
|
27
27
|
buildCommand;
|
|
28
28
|
constructor(buildCommand) {
|
|
29
29
|
this.buildCommand = buildCommand;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/commands-config.ts"],"names":[],"mappings":";AAAA,kGAAkG;AAClG,oGAAoG;AACpG,gGAAgG;AAChG,oGAAoG;AACpG,EAAE;AACF,sGAAsG;;;AAyEtG,kDAmBC;AA1FD,qDAAmE;AAEnE,oGAAoG;AACpG,wFAAwF;AAC3E,QAAA,yBAAyB,GAAG,yBAAyB,CAAC;AACtD,QAAA,8BAA8B,GAAG,0BAA0B,CAAC;AAEzE;;;;;;;;GAQG;AACH,MAAa,aAAa;IACtB
|
|
1
|
+
{"version":3,"file":"commands-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules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;QAChB,CAAC,CAAC,EAAE,CAAC;IACT,MAAM,QAAQ,GAAG,OAAO,KAAK,CAAC,gBAAgB,KAAK,QAAQ,IAAI,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,KAAK,EAAE;QAC/F,CAAC,CAAC,KAAK,CAAC,gBAAgB;QACxB,CAAC,CAAC,iCAAyB,CAAC;IAChC,MAAM,aAAa,GAAG,OAAO,KAAK,CAAC,eAAe,KAAK,QAAQ,IAAI,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,KAAK,EAAE;QAClG,CAAC,CAAC,KAAK,CAAC,eAAe;QACvB,CAAC,CAAC,sCAA8B,CAAC;IACrC,MAAM,UAAU,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC;IACnC,MAAM,QAAQ,GAAG,OAAO,UAAU,KAAK,QAAQ,IAAI,UAAU,KAAK,IAAI;WAC/D,OAAO,UAAU,CAAC,YAAY,KAAK,QAAQ,IAAI,UAAU,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,EAAE;QACvF,CAAC,CAAC,UAAU,CAAC,YAAY;QACzB,CAAC,CAAC,SAAS,CAAC;IAChB,OAAO,IAAI,cAAc,CAAC,IAAA,kCAAiB,EAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,aAAa,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;AACvH,CAAC","sourcesContent":["// The \"commands\" section of webpieces.config.json. It configures the gated command endpoints that\n// the bash guards point agents toward (instead of running raw `gh pr create` / finishing a merge by\n// hand), plus the pr-gate build dashboard. pr-gate lives here (not at the top level) because it\n// configures the wp-start-upsert-pr / wp-finish-upsert-pr commands — the guards only POINT at them.\n//\n// Data-only (per CLAUDE.md, classes for data). Built + validated by loadAndValidate (load-config.ts).\n\nimport { PrGateConfig, buildPrGateConfig } from './pr-gate-config';\n\n// Canonical gated commands. Guards default their command hints to these so a project that renames a\n// command edits it in ONE place (the commands section) and every guard message follows.\nexport const DEFAULT_UPSERT_PR_COMMAND = 'pnpm wp-start-upsert-pr';\nexport const DEFAULT_MERGE_COMPLETE_COMMAND = 'pnpm wp-finish-upsert-pr';\n\n/**\n * `commands.push-dev` — what `wp-build-push-dev` runs before `wp-finish-push-dev` publishes a dev copy (#1397, #1403).\n *\n * `buildCommand` has NO default, deliberately (`.claude/rules/no-rule-defaults.md`): which build vouches\n * for a dev publish is the consumer's decision, and a default would run a build nobody chose. Absent ⇒\n * `undefined`, and the command that needs it refuses, naming the key and printing the entry to paste.\n * The section itself is optional at LOAD time because a repo that never publishes to a shared dev server\n * has nothing to configure here.\n */\nexport class PushDevConfig {\n /** The dev-scoped build, e.g. `pnpm nx affected -t build test --base=origin/dev --head=HEAD`. */\n buildCommand: string | undefined;\n\n constructor(buildCommand: string | undefined) {\n this.buildCommand = buildCommand;\n }\n}\n\nexport class CommandsConfig {\n prGate: PrGateConfig;\n // `commands.push-dev` — the dev-scoped pre-publish build. See PushDevConfig.\n pushDev: PushDevConfig;\n // Command the pr-creation-or-push-guard tells agents to run instead of `gh pr create` or a manual push.\n // Sourced from commands.guardHints.prCreationOrPush.\n upsertPr: string;\n // Command the merge-in-progress-guard tells agents to run to finish a 3-point merge.\n // Sourced from commands.guardHints.mergeInProgress.\n mergeComplete: string;\n\n constructor(prGate: PrGateConfig, pushDev: PushDevConfig, upsertPr: string, mergeComplete: string) {\n this.prGate = prGate;\n this.pushDev = pushDev;\n this.upsertPr = upsertPr;\n this.mergeComplete = mergeComplete;\n }\n}\n\n// The `commands.guardHints` sub-object: the ONLY command strings the guards read (each maps to exactly\n// one guard). Grouped under `guardHints` so the file makes plain these are guard hints — not pr-gate\n// config, and not command behaviour. `prCreationOrPush` → pr-creation-or-push-guard;\n// `mergeInProgress` → merge-in-progress-guard.\ninterface RawGuardHints {\n prCreationOrPush?: string;\n mergeInProgress?: string;\n}\n\ninterface RawCommandsSection {\n // webpieces-disable no-any-unknown -- opaque pr-gate JSON, validated by validatePrGateSection\n 'pr-gate'?: unknown;\n 'push-dev'?: { buildCommand?: unknown };\n guardHints?: RawGuardHints;\n}\n\n/**\n * Build a CommandsConfig from the already-parsed `commands` section, falling back to the built-in default\n * for any field the consumer omits. Pure transform — the structural validation happens in loadAndValidate.\n *\n * ONE accepted source per field: commands.guardHints.<name>, else the built-in default. The retired flat\n * `commands.upsertPr` / `commands.mergeComplete` strings are NOT read — validateCommandsSection fails the\n * load with the move instruction instead. A resolution chain that quietly accepts the old key is exactly\n * what kept this repo's own config on the dead shape for releases; see retired-config-keys.ts.\n */\n// webpieces-disable no-any-unknown -- `section` is opaque consumer JSON until narrowed here\n// webpieces-disable no-function-outside-class -- module-level config transform, matches buildPrGateConfig in pr-gate-config.ts\nexport function buildCommandsConfig(section: unknown): CommandsConfig {\n const raw: RawCommandsSection = (typeof section === 'object' && section !== null)\n ? (section as RawCommandsSection)\n : {};\n const hints: RawGuardHints = (typeof raw.guardHints === 'object' && raw.guardHints !== null)\n ? raw.guardHints\n : {};\n const upsertPr = typeof hints.prCreationOrPush === 'string' && hints.prCreationOrPush.trim() !== ''\n ? hints.prCreationOrPush\n : DEFAULT_UPSERT_PR_COMMAND;\n const mergeComplete = typeof hints.mergeInProgress === 'string' && hints.mergeInProgress.trim() !== ''\n ? hints.mergeInProgress\n : DEFAULT_MERGE_COMPLETE_COMMAND;\n const pushDevRaw = raw['push-dev'];\n const devBuild = typeof pushDevRaw === 'object' && pushDevRaw !== null\n && typeof pushDevRaw.buildCommand === 'string' && pushDevRaw.buildCommand.trim() !== ''\n ? pushDevRaw.buildCommand\n : undefined;\n return new CommandsConfig(buildPrGateConfig(raw['pr-gate']), new PushDevConfig(devBuild), upsertPr, mergeComplete);\n}\n"]}
|
|
@@ -69,7 +69,7 @@ function validatePushDev(section) {
|
|
|
69
69
|
const cmd = p['buildCommand'];
|
|
70
70
|
if (typeof cmd !== 'string' || cmd.trim() === '') {
|
|
71
71
|
errors.push(`[commands.push-dev] "buildCommand" is required and must be a non-empty string: the dev-scoped build ` +
|
|
72
|
-
`wp-build-push-dev runs before wp-finish-push-dev publishes, e.g. "pnpm nx affected
|
|
72
|
+
`wp-build-push-dev runs on the merge with origin/dev before wp-finish-push-dev publishes — compile + tests only, no code rules — e.g. "pnpm nx affected -t build test --base=origin/dev --head=HEAD". ` +
|
|
73
73
|
`There is no default. Config instructions: ${config_documentation_1.CONFIG_DOCUMENTATION_PATH}.`);
|
|
74
74
|
}
|
|
75
75
|
return errors;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands-section-validators.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/commands-section-validators.ts"],"names":[],"mappings":";;AA4BA,0DA6BC;AAzDD,+DAAiE;AACjE,yDAAsD;AACtD,iEAAmE;AACnE,+DAA2D;AAC3D,uDAA0D;AAE1D,yGAAyG;AACzG,mGAAmG;AACnG,2FAA2F;AAC3F,gEAAgE;AAEhE,uGAAuG;AACvG,kGAAkG;AAClG,MAAM,aAAa,GAAsB,CAAC,SAAS,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;AAC/E,MAAM,eAAe,GAAsB,CAAC,cAAc,CAAC,CAAC;AAC5D,MAAM,iBAAiB,GAAsB,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,CAAC;AAErF;;;;;;;;GAQG;AACH,yFAAyF;AACzF,8GAA8G;AAC9G,SAAgB,uBAAuB,CAAC,QAAiB,EAAE,YAAqB,EAAE,QAAiB;IAC/F,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,CAAC,IAAI;QACP,gGAAgG;QAChG,yEAAyE;QACzE,qCAAqC,8CAAwB,iCAAiC;YAC9F,iCAAiC,CACpC,CAAC;IACN,CAAC;IAED,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC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,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QAC/C,MAAM,CAAC,IAAI,CACP,sGAAsG;YACtG,
|
|
1
|
+
{"version":3,"file":"commands-section-validators.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/commands-section-validators.ts"],"names":[],"mappings":";;AA4BA,0DA6BC;AAzDD,+DAAiE;AACjE,yDAAsD;AACtD,iEAAmE;AACnE,+DAA2D;AAC3D,uDAA0D;AAE1D,yGAAyG;AACzG,mGAAmG;AACnG,2FAA2F;AAC3F,gEAAgE;AAEhE,uGAAuG;AACvG,kGAAkG;AAClG,MAAM,aAAa,GAAsB,CAAC,SAAS,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;AAC/E,MAAM,eAAe,GAAsB,CAAC,cAAc,CAAC,CAAC;AAC5D,MAAM,iBAAiB,GAAsB,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,CAAC;AAErF;;;;;;;;GAQG;AACH,yFAAyF;AACzF,8GAA8G;AAC9G,SAAgB,uBAAuB,CAAC,QAAiB,EAAE,YAAqB,EAAE,QAAiB;IAC/F,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QAC7B,MAAM,CAAC,IAAI;QACP,gGAAgG;QAChG,yEAAyE;QACzE,qCAAqC,8CAAwB,iCAAiC;YAC9F,iCAAiC,CACpC,CAAC;IACN,CAAC;IAED,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;QAC3G,MAAM,CAAC,IAAI,CAAC,yEAAyE,CAAC,CAAC;QACvF,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,+FAA+F;IAC/F,MAAM,CAAC,GAAG,CAAC,QAAQ,IAAI,EAAE,CAA4B,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AC;IACN,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;GAGG;AACH,0FAA0F;AAC1F,8GAA8G;AAC9G,SAAS,kBAAkB,CAAC,KAAc;IACtC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACnC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACtE,OAAO,CAAC,oGAAoG,CAAC,CAAC;IAClH,CAAC;IACD,gGAAgG;IAChG,MAAM,CAAC,GAAG,KAAgC,CAAC;IAC3C,MAAM,MAAM,GAAa,IAAA,mCAAgB,EAAC,CAAC,EAAE,iBAAiB,EAAE,uBAAuB,CAAC,CAAC;IACzF,KAAK,MAAM,KAAK,IAAI,iBAAiB,EAAE,CAAC;QACpC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,KAAK,QAAQ,IAAK,CAAC,CAAC,KAAK,CAAY,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;YACrF,MAAM,CAAC,IAAI,CAAC,0BAA0B,KAAK,0DAA0D,CAAC,CAAC;QAC3G,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { RETIRED_TOP_LEVEL_MARKER } from './config-error-banner';\nimport { unknownKeyErrors } from './config-key-rules';\nimport { CONFIG_DOCUMENTATION_PATH } from './config-documentation';\nimport { retiredKeyErrorsIn } from './retired-config-keys';\nimport { validatePrGateSection } from './validate-config';\n\n// The `commands` section of webpieces.config.json, plus the key-level rules every section shares: strict\n// unknown-key rejection and external documentation. Split out of validate-config.ts only for size,\n// exactly as pr-gate-section-validators.ts was; loadAndValidate still reaches this through\n// validateCommandsSection, which validate-config.ts re-exports.\n\n// Every key the `commands` section defines. Anything else is rejected — see unknownKeyErrors for why a\n// tolerated unknown key is the mechanism by which a stale config shape survives upgrades forever.\nconst COMMANDS_KEYS: readonly string[] = ['pr-gate', 'push-dev', 'guardHints'];\nconst PUSH_DEV_FIELDS: readonly string[] = ['buildCommand'];\nconst GUARD_HINT_FIELDS: readonly string[] = ['prCreationOrPush', 'mergeInProgress'];\n\n/**\n * Validate the `commands` section: its `pr-gate` block (delegated to validatePrGateSection), the\n * `guardHints` command strings, and strict rejection of everything else. Also surfaces a migration error if\n * a DEPRECATED top-level `pr-gate` block is still present, telling the consumer to move it under `commands`.\n *\n * There is deliberately no fallback from `commands[\"pr-gate\"]` to the top-level block: the top-level block\n * is a hard error above, so a config carrying it never loads, and a fallback for a shape that cannot load is\n * dead code that only makes the real shape ambiguous. See retired-config-keys.ts for the policy.\n */\n// webpieces-disable no-any-unknown -- `commands`/`legacyPrGate` are opaque consumer JSON\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nexport function validateCommandsSection(commands: unknown, legacyPrGate: unknown, repoRoot?: string): string[] {\n const errors: string[] = [];\n\n if (legacyPrGate !== undefined) {\n errors.push(\n // RETIRED_TOP_LEVEL_MARKER is imported, not re-typed: it is what the banner classifier keys off\n // to call this DEFINITIVE (a shape no version of the validator accepts).\n `[pr-gate] The top-level \"pr-gate\" ${RETIRED_TOP_LEVEL_MARKER}. Move it under the \"commands\" ` +\n `section as commands[\"pr-gate\"].`,\n );\n }\n\n if (commands !== undefined && (typeof commands !== 'object' || commands === null || Array.isArray(commands))) {\n errors.push(`[commands] Must be an object { \"pr-gate\": {...}, \"guardHints\": {...} }.`);\n return errors;\n }\n\n // webpieces-disable no-any-unknown -- narrowing the opaque commands section from consumer JSON\n const c = (commands ?? {}) as Record<string, unknown>;\n\n errors.push(...retiredKeyErrorsIn(c, '[commands]'));\n errors.push(...unknownKeyErrors(c, COMMANDS_KEYS, '[commands]'));\n\n // pr-gate is required (set mode OFF to opt out).\n errors.push(...validatePrGateSection(c['pr-gate'], repoRoot));\n errors.push(...validateGuardHints(c['guardHints']));\n errors.push(...validatePushDev(c['push-dev']));\n\n return errors;\n}\n\n/**\n * The optional `commands.push-dev` block (#1397). Absent is valid — a repo that never publishes to a\n * shared dev server configures nothing — but once present it must carry a non-empty `buildCommand`: a\n * half-written block is a decision somebody started and did not finish, and there is no default to fill\n * the gap (`.claude/rules/no-rule-defaults.md`).\n */\n// webpieces-disable no-any-unknown -- `section` is opaque consumer JSON until narrowed here\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nfunction validatePushDev(section: unknown): string[] {\n if (section === undefined) return [];\n if (typeof section !== 'object' || section === null || Array.isArray(section)) {\n return [`[commands] \"push-dev\" must be an object { \"buildCommand\": \"...\" }.`];\n }\n // webpieces-disable no-any-unknown -- narrowing the opaque push-dev object from consumer JSON\n const p = section as Record<string, unknown>;\n const errors: string[] = unknownKeyErrors(p, PUSH_DEV_FIELDS, '[commands.push-dev]');\n const cmd = p['buildCommand'];\n if (typeof cmd !== 'string' || cmd.trim() === '') {\n errors.push(\n `[commands.push-dev] \"buildCommand\" is required and must be a non-empty string: the dev-scoped build ` +\n `wp-build-push-dev runs on the merge with origin/dev before wp-finish-push-dev publishes — compile + tests only, no code rules — e.g. \"pnpm nx affected -t build test --base=origin/dev --head=HEAD\". ` +\n `There is no default. Config instructions: ${CONFIG_DOCUMENTATION_PATH}.`,\n );\n }\n return errors;\n}\n\n/**\n * The `commands.guardHints` sub-object: the command strings the bash guards print in their fix hints. Each\n * name binds to exactly one guard, so an unknown field here is a hint nothing will ever read.\n */\n// webpieces-disable no-any-unknown -- `hints` is opaque consumer JSON until narrowed here\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nfunction validateGuardHints(hints: unknown): string[] {\n if (hints === undefined) return [];\n if (typeof hints !== 'object' || hints === null || Array.isArray(hints)) {\n return [`[commands] \"guardHints\" must be an object { \"prCreationOrPush\": \"...\", \"mergeInProgress\": \"...\" }.`];\n }\n // webpieces-disable no-any-unknown -- narrowing the opaque guardHints object from consumer JSON\n const h = hints as Record<string, unknown>;\n const errors: string[] = unknownKeyErrors(h, GUARD_HINT_FIELDS, '[commands.guardHints]');\n for (const field of GUARD_HINT_FIELDS) {\n if (field in h && (typeof h[field] !== 'string' || (h[field] as string).trim() === '')) {\n errors.push(`[commands] \"guardHints.${field}\" must be a non-empty string (the gated command to run).`);\n }\n }\n return errors;\n}\n"]}
|
|
@@ -74,8 +74,9 @@ class SyncFlowGuidance {
|
|
|
74
74
|
' C. You just want it on the SHARED DEV SERVER — no PR, not landing on main:',
|
|
75
75
|
` 1. ${exports.WP_START_PUSH_DEV} ← 3-point merge from main, ONLY if the branch is behind it`,
|
|
76
76
|
' /wp-merge ← resolve main conflicts (ONLY if step 1 reported any)',
|
|
77
|
-
` 2. ${exports.WP_BUILD_PUSH_DEV} ←
|
|
78
|
-
'
|
|
77
|
+
` 2. ${exports.WP_BUILD_PUSH_DEV} ← build your branch against main (code rules ON), then merge`,
|
|
78
|
+
' origin/dev into a throwaway, pnpm install, and run',
|
|
79
|
+
' commands.push-dev.buildCommand on it (compile + tests only)',
|
|
79
80
|
' resolve dev conflicts in the files it lists, then re-run it (ONLY if it reported any)',
|
|
80
81
|
` 3. ${exports.WP_FINISH_PUSH_DEV} ← publish the copy step 2 verified`,
|
|
81
82
|
' Your branch never acquires another dev\'s commits — the dev merge happens on a throwaway,',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-flow-guidance.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/sync-flow-guidance.ts"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,EAAE;AACF,qGAAqG;AACrG,qGAAqG;AACrG,qGAAqG;AACrG,qGAAqG;AACrG,wBAAwB;;;AAExB,6EAA6E;AAChE,QAAA,eAAe,GAAG,sBAAsB,CAAC;AACzC,QAAA,gBAAgB,GAAG,uBAAuB,CAAC;AAC3C,QAAA,kBAAkB,GAAG,yBAAyB,CAAC;AAC/C,QAAA,mBAAmB,GAAG,0BAA0B,CAAC;AAE9D,2GAA2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,4CAA4C;SAC/C,CAAC;IACN,CAAC;IAED,8FAA8F;IAC9F,gBAAgB;QACZ,OAAO;YACH,6FAA6F;YAC7F,2FAA2F;YAC3F,8FAA8F;YAC9F,4FAA4F;YAC5F,4DAA4D;SAC/D,CAAC;IACN,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,aAAqB;QAC7B,IAAI,aAAa,KAAK,kBAAkB;YAAE,OAAO,iBAAiB,CAAC;QACnE,IAAI,aAAa,KAAK,qBAAqB;YAAE,OAAO,oBAAoB,CAAC;QACzE,OAAO,aAAa,CAAC;IACzB,CAAC;IAED,oGAAoG;IACpG,gGAAgG;IAChG,0FAA0F;IAC1F,mGAAmG;IACnG,yFAAyF;IAEzF;;;;OAIG;IACH,cAAc;QACV,OAAO;YACH,4FAA4F;YAC5F,6FAA6F;YAC7F,0FAA0F;YAC1F,sFAAsF;YACtF,yFAAyF;YACzF,iGAAiG;YACjG,4FAA4F;YAC5F,2FAA2F;YAC3F,2FAA2F;YAC3F,kFAAkF;SACrF,CAAC;IACN,CAAC;CACJ;AAtHD,4CAsHC","sourcesContent":["// SINGLE SOURCE OF TRUTH for \"how do I bring main into my branch\" as told to an AI.\n//\n// Why this file exists: the guards and the pr-gate bins each used to hand-write their own version of\n// this advice, and they drifted — one message told the AI to START with `wp-start-update` and FINISH\n// with `wp-finish-upsert-pr`, which is a pairing that does not exist. An AI reading that cannot tell\n// which flow it is in. Every guard/bin message now renders from HERE, so the two flows can only ever\n// be described one way.\n\n// The four gated bins, as the AI must type them. Two flows, two halves each.\nexport const WP_START_UPDATE = 'pnpm wp-start-update';\nexport const WP_FINISH_UPDATE = 'pnpm wp-finish-update';\nexport const WP_START_UPSERT_PR = 'pnpm wp-start-upsert-pr';\nexport const WP_FINISH_UPSERT_PR = 'pnpm wp-finish-upsert-pr';\n\n// The dev-deploy trio (#1403), staged like the upsert-pr flow. NOT a way to land anything — it publishes a\n// DISPOSABLE copy of the branch so a shared dev environment can build it, and never opens a PR. Stage ①\n// brings the branch up to date with main (the same 3-point merge as the other two flows); ② checks the\n// branch against origin/dev on a throwaway merge and builds it; ③ publishes the copy ② verified.\nexport const WP_START_PUSH_DEV = 'pnpm wp-start-push-dev';\nexport const WP_BUILD_PUSH_DEV = 'pnpm wp-build-push-dev';\nexport const WP_FINISH_PUSH_DEV = 'pnpm wp-finish-push-dev';\n\n/**\n * Renders the canonical guidance blocks. Methods return string[] (not a joined string) so callers can\n * indent//interleave them into their own message without re-wrapping.\n */\nexport class SyncFlowGuidance {\n /**\n * Both flows, ALWAYS paired. Use this when the caller does NOT know whether a PR is open — an AI\n * shown only one flow picks it even when the other one is the correct one.\n */\n flows(): string[] {\n return [\n 'There are exactly TWO flows. Which one you use is decided by ONE question:',\n 'is there already an OPEN PR for this branch?',\n '',\n ]\n .concat(this.updateOnlyFlow())\n .concat([''])\n .concat(this.prFlow())\n .concat([''])\n .concat(this.pairingRule())\n .concat([''])\n .concat(this.whyPrForcesFlowB());\n }\n\n /** Flow A — no PR open yet. */\n updateOnlyFlow(): string[] {\n return [\n ' A. NO PR yet — update-only flow (you are mid-work and just want main\\'s changes):',\n ` 1. ${WP_START_UPDATE} ← 3-point merge from main (auto-finalizes if clean)`,\n ' 2. /wp-merge ← resolve conflicts (ONLY if step 1 reported any)',\n ` 3. ${WP_FINISH_UPDATE} ← finalize (ONLY on the conflict path)`,\n ];\n }\n\n /** Flow B — a PR is open (or is about to be). */\n prFlow(): string[] {\n return [\n ' B. A PR IS ALREADY OPEN (or you are ready to post one) — PR flow:',\n ` 1. ${WP_START_UPSERT_PR} ← same 3-point merge, then push`,\n ' 2. /wp-merge ← resolve conflicts (ONLY if step 1 reported any)',\n ` 3. ${WP_FINISH_UPSERT_PR} ← authoritative build gate, then create/update the PR`,\n ];\n }\n\n /**\n * Flow C — get this branch onto the shared dev server WITHOUT landing it on main.\n *\n * Deliberately printed as a THIRD destination rather than folded into flow B, because the two are\n * opposites and an AI shown only the PR flow will open a PR when it was asked to deploy. Landing on\n * main ships to production; this publishes a throwaway copy that the dev environment's CI composes\n * and rebuilds. It never moves the feature branch and never opens a PR.\n */\n devDeployFlow(): string[] {\n return [\n ' C. You just want it on the SHARED DEV SERVER — no PR, not landing on main:',\n ` 1. ${WP_START_PUSH_DEV} ← 3-point merge from main, ONLY if the branch is behind it`,\n ' /wp-merge ← resolve main conflicts (ONLY if step 1 reported any)',\n ` 2. ${WP_BUILD_PUSH_DEV} ← merge origin/dev into a throwaway, pnpm install, then`,\n ' run commands.push-dev.buildCommand on it',\n ' resolve dev conflicts in the files it lists, then re-run it (ONLY if it reported any)',\n ` 3. ${WP_FINISH_PUSH_DEV} ← publish the copy step 2 verified`,\n ' Your branch never acquires another dev\\'s commits — the dev merge happens on a throwaway,',\n ' which is the whole reason the copy exists.',\n ];\n }\n\n /** The half that keeps drifting: a start from one pair NEVER finishes with the other's finish. */\n pairingRule(): string[] {\n return [\n 'PAIRING IS NOT OPTIONAL — a start and a finish from different flows is not a thing:',\n ' wp-start-update → wp-finish-update',\n ' wp-start-upsert-pr → wp-finish-upsert-pr',\n ];\n }\n\n /** Why an open PR removes the choice. Safe to print on its own alongside just the PR flow. */\n whyPrForcesFlowB(): string[] {\n return [\n 'If a PR is open you MUST use the upsert-pr pair. The 3-point merge REWRITES this branch (it',\n 'squashes onto main and force-pushes a new generation), so the open PR\\'s history is blown',\n 'away and has to be re-pointed in the SAME run. The update-only pair never touches the PR, so',\n 'running it with a PR open would strand that PR on the OLD branch generation — which is why',\n 'wp-start-update refuses outright when it finds an open PR.',\n ];\n }\n\n /**\n * The start bin that PAIRS with a finish bin (bare names, no `pnpm` prefix) — so generated text can\n * name the command that actually produced it instead of guessing one of the two. Anything\n * unrecognized comes back unchanged rather than inventing a name.\n */\n pairedStart(finishCommand: string): string {\n if (finishCommand === 'wp-finish-update') return 'wp-start-update';\n if (finishCommand === 'wp-finish-upsert-pr') return 'wp-start-upsert-pr';\n return finishCommand;\n }\n\n // updateMainAdvice() / featureBranchSyncAdvice() were DELETED 2026-08-03. Their only caller was the\n // shim's fault-D deny, and both paragraphs were another guard's job: redirect-how-to-merge-main\n // fires on its own, with its own message, on exactly the commands they warned about — and\n // featureBranchSyncAdvice() named wp-start-update / wp-start-upsert-pr only to say \"not while this\n // block is up\", which is pure cost in a message whose one instruction is `pnpm install`.\n\n /**\n * The read-only alternatives, for when the AI only wanted to LOOK at how it stands vs main. This\n * exists because `git merge --ff-only origin/main` gets typed as if it were a query — it is not,\n * it mutates the branch whenever it succeeds, which is exactly the case you were probing for.\n */\n readOnlyChecks(): string[] {\n return [\n 'Only wanted to LOOK (am I behind main? would it fast-forward?) — none of the below mutate:',\n ' git fetch origin main ← refresh the remote ref (no merge)',\n ' git merge-base --is-ancestor origin/main HEAD ← exit 0 = already contains main',\n ' git rev-list --left-right --count origin/main...HEAD ← prints \"<behind> <ahead>\"',\n ' git log --oneline HEAD..origin/main ← what main has that you do not',\n ' git diff --stat origin/main...HEAD ← what you changed since the fork point',\n ' cat .webpieces/main-sync-status.json ← the tooling\\'s own answer, incl.',\n ' the files predicted to conflict',\n '`git merge --ff-only` is NOT a look — it MUTATES on success (that is the whole point of a',\n 'fast-forward), so it is blocked like every other merge. Never use it as a probe.',\n ];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sync-flow-guidance.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/sync-flow-guidance.ts"],"names":[],"mappings":";AAAA,oFAAoF;AACpF,EAAE;AACF,qGAAqG;AACrG,qGAAqG;AACrG,qGAAqG;AACrG,qGAAqG;AACrG,wBAAwB;;;AAExB,6EAA6E;AAChE,QAAA,eAAe,GAAG,sBAAsB,CAAC;AACzC,QAAA,gBAAgB,GAAG,uBAAuB,CAAC;AAC3C,QAAA,kBAAkB,GAAG,yBAAyB,CAAC;AAC/C,QAAA,mBAAmB,GAAG,0BAA0B,CAAC;AAE9D,2GAA2G;AAC3G,wGAAwG;AACxG,uGAAuG;AACvG,iGAAiG;AACpF,QAAA,iBAAiB,GAAG,w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;QACZ,OAAO;YACH,6FAA6F;YAC7F,2FAA2F;YAC3F,8FAA8F;YAC9F,4FAA4F;YAC5F,4DAA4D;SAC/D,CAAC;IACN,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,aAAqB;QAC7B,IAAI,aAAa,KAAK,kBAAkB;YAAE,OAAO,iBAAiB,CAAC;QACnE,IAAI,aAAa,KAAK,qBAAqB;YAAE,OAAO,oBAAoB,CAAC;QACzE,OAAO,aAAa,CAAC;IACzB,CAAC;IAED,oGAAoG;IACpG,gGAAgG;IAChG,0FAA0F;IAC1F,mGAAmG;IACnG,yFAAyF;IAEzF;;;;OAIG;IACH,cAAc;QACV,OAAO;YACH,4FAA4F;YAC5F,6FAA6F;YAC7F,0FAA0F;YAC1F,sFAAsF;YACtF,yFAAyF;YACzF,iGAAiG;YACjG,4FAA4F;YAC5F,2FAA2F;YAC3F,2FAA2F;YAC3F,kFAAkF;SACrF,CAAC;IACN,CAAC;CACJ;AAvHD,4CAuHC","sourcesContent":["// SINGLE SOURCE OF TRUTH for \"how do I bring main into my branch\" as told to an AI.\n//\n// Why this file exists: the guards and the pr-gate bins each used to hand-write their own version of\n// this advice, and they drifted — one message told the AI to START with `wp-start-update` and FINISH\n// with `wp-finish-upsert-pr`, which is a pairing that does not exist. An AI reading that cannot tell\n// which flow it is in. Every guard/bin message now renders from HERE, so the two flows can only ever\n// be described one way.\n\n// The four gated bins, as the AI must type them. Two flows, two halves each.\nexport const WP_START_UPDATE = 'pnpm wp-start-update';\nexport const WP_FINISH_UPDATE = 'pnpm wp-finish-update';\nexport const WP_START_UPSERT_PR = 'pnpm wp-start-upsert-pr';\nexport const WP_FINISH_UPSERT_PR = 'pnpm wp-finish-upsert-pr';\n\n// The dev-deploy trio (#1403), staged like the upsert-pr flow. NOT a way to land anything — it publishes a\n// DISPOSABLE copy of the branch so a shared dev environment can build it, and never opens a PR. Stage ①\n// brings the branch up to date with main (the same 3-point merge as the other two flows); ② checks the\n// branch against origin/dev on a throwaway merge and builds it; ③ publishes the copy ② verified.\nexport const WP_START_PUSH_DEV = 'pnpm wp-start-push-dev';\nexport const WP_BUILD_PUSH_DEV = 'pnpm wp-build-push-dev';\nexport const WP_FINISH_PUSH_DEV = 'pnpm wp-finish-push-dev';\n\n/**\n * Renders the canonical guidance blocks. Methods return string[] (not a joined string) so callers can\n * indent//interleave them into their own message without re-wrapping.\n */\nexport class SyncFlowGuidance {\n /**\n * Both flows, ALWAYS paired. Use this when the caller does NOT know whether a PR is open — an AI\n * shown only one flow picks it even when the other one is the correct one.\n */\n flows(): string[] {\n return [\n 'There are exactly TWO flows. Which one you use is decided by ONE question:',\n 'is there already an OPEN PR for this branch?',\n '',\n ]\n .concat(this.updateOnlyFlow())\n .concat([''])\n .concat(this.prFlow())\n .concat([''])\n .concat(this.pairingRule())\n .concat([''])\n .concat(this.whyPrForcesFlowB());\n }\n\n /** Flow A — no PR open yet. */\n updateOnlyFlow(): string[] {\n return [\n ' A. NO PR yet — update-only flow (you are mid-work and just want main\\'s changes):',\n ` 1. ${WP_START_UPDATE} ← 3-point merge from main (auto-finalizes if clean)`,\n ' 2. /wp-merge ← resolve conflicts (ONLY if step 1 reported any)',\n ` 3. ${WP_FINISH_UPDATE} ← finalize (ONLY on the conflict path)`,\n ];\n }\n\n /** Flow B — a PR is open (or is about to be). */\n prFlow(): string[] {\n return [\n ' B. A PR IS ALREADY OPEN (or you are ready to post one) — PR flow:',\n ` 1. ${WP_START_UPSERT_PR} ← same 3-point merge, then push`,\n ' 2. /wp-merge ← resolve conflicts (ONLY if step 1 reported any)',\n ` 3. ${WP_FINISH_UPSERT_PR} ← authoritative build gate, then create/update the PR`,\n ];\n }\n\n /**\n * Flow C — get this branch onto the shared dev server WITHOUT landing it on main.\n *\n * Deliberately printed as a THIRD destination rather than folded into flow B, because the two are\n * opposites and an AI shown only the PR flow will open a PR when it was asked to deploy. Landing on\n * main ships to production; this publishes a throwaway copy that the dev environment's CI composes\n * and rebuilds. It never moves the feature branch and never opens a PR.\n */\n devDeployFlow(): string[] {\n return [\n ' C. You just want it on the SHARED DEV SERVER — no PR, not landing on main:',\n ` 1. ${WP_START_PUSH_DEV} ← 3-point merge from main, ONLY if the branch is behind it`,\n ' /wp-merge ← resolve main conflicts (ONLY if step 1 reported any)',\n ` 2. ${WP_BUILD_PUSH_DEV} ← build your branch against main (code rules ON), then merge`,\n ' origin/dev into a throwaway, pnpm install, and run',\n ' commands.push-dev.buildCommand on it (compile + tests only)',\n ' resolve dev conflicts in the files it lists, then re-run it (ONLY if it reported any)',\n ` 3. ${WP_FINISH_PUSH_DEV} ← publish the copy step 2 verified`,\n ' Your branch never acquires another dev\\'s commits — the dev merge happens on a throwaway,',\n ' which is the whole reason the copy exists.',\n ];\n }\n\n /** The half that keeps drifting: a start from one pair NEVER finishes with the other's finish. */\n pairingRule(): string[] {\n return [\n 'PAIRING IS NOT OPTIONAL — a start and a finish from different flows is not a thing:',\n ' wp-start-update → wp-finish-update',\n ' wp-start-upsert-pr → wp-finish-upsert-pr',\n ];\n }\n\n /** Why an open PR removes the choice. Safe to print on its own alongside just the PR flow. */\n whyPrForcesFlowB(): string[] {\n return [\n 'If a PR is open you MUST use the upsert-pr pair. The 3-point merge REWRITES this branch (it',\n 'squashes onto main and force-pushes a new generation), so the open PR\\'s history is blown',\n 'away and has to be re-pointed in the SAME run. The update-only pair never touches the PR, so',\n 'running it with a PR open would strand that PR on the OLD branch generation — which is why',\n 'wp-start-update refuses outright when it finds an open PR.',\n ];\n }\n\n /**\n * The start bin that PAIRS with a finish bin (bare names, no `pnpm` prefix) — so generated text can\n * name the command that actually produced it instead of guessing one of the two. Anything\n * unrecognized comes back unchanged rather than inventing a name.\n */\n pairedStart(finishCommand: string): string {\n if (finishCommand === 'wp-finish-update') return 'wp-start-update';\n if (finishCommand === 'wp-finish-upsert-pr') return 'wp-start-upsert-pr';\n return finishCommand;\n }\n\n // updateMainAdvice() / featureBranchSyncAdvice() were DELETED 2026-08-03. Their only caller was the\n // shim's fault-D deny, and both paragraphs were another guard's job: redirect-how-to-merge-main\n // fires on its own, with its own message, on exactly the commands they warned about — and\n // featureBranchSyncAdvice() named wp-start-update / wp-start-upsert-pr only to say \"not while this\n // block is up\", which is pure cost in a message whose one instruction is `pnpm install`.\n\n /**\n * The read-only alternatives, for when the AI only wanted to LOOK at how it stands vs main. This\n * exists because `git merge --ff-only origin/main` gets typed as if it were a query — it is not,\n * it mutates the branch whenever it succeeds, which is exactly the case you were probing for.\n */\n readOnlyChecks(): string[] {\n return [\n 'Only wanted to LOOK (am I behind main? would it fast-forward?) — none of the below mutate:',\n ' git fetch origin main ← refresh the remote ref (no merge)',\n ' git merge-base --is-ancestor origin/main HEAD ← exit 0 = already contains main',\n ' git rev-list --left-right --count origin/main...HEAD ← prints \"<behind> <ahead>\"',\n ' git log --oneline HEAD..origin/main ← what main has that you do not',\n ' git diff --stat origin/main...HEAD ← what you changed since the fork point',\n ' cat .webpieces/main-sync-status.json ← the tooling\\'s own answer, incl.',\n ' the files predicted to conflict',\n '`git merge --ff-only` is NOT a look — it MUTATES on success (that is the whole point of a',\n 'fast-forward), so it is blocked like every other merge. Never use it as a probe.',\n ];\n }\n}\n"]}
|
|
@@ -77,17 +77,23 @@ put reusable config instructions in this guide's source template. Generated file
|
|
|
77
77
|
|
|
78
78
|
## The dev-deploy build: `commands.push-dev.buildCommand`
|
|
79
79
|
|
|
80
|
-
`wp-build-push-dev`
|
|
81
|
-
|
|
80
|
+
`wp-build-push-dev` first runs `commands.pr-gate.buildCommand` on your branch alone (the code rules judge it
|
|
81
|
+
against main, exactly as the PR gate will), then merges `origin/dev` into a throwaway branch, runs
|
|
82
|
+
`pnpm install`, and runs this command on the merged tree; `wp-finish-push-dev` publishes only the copy it
|
|
83
|
+
verified. It has NO default — which
|
|
82
84
|
build vouches for a dev publish is this repo's decision. The section is optional (a repo that never
|
|
83
85
|
publishes to a shared dev server needs none), but `wp-build-push-dev` refuses without it, and a present
|
|
84
86
|
`push-dev` section must carry a non-empty `buildCommand`:
|
|
85
87
|
|
|
86
88
|
```json
|
|
87
|
-
"commands": { "push-dev": { "buildCommand": "pnpm nx affected
|
|
89
|
+
"commands": { "push-dev": { "buildCommand": "pnpm nx affected -t build test --base=origin/dev --head=HEAD" } }
|
|
88
90
|
```
|
|
89
91
|
|
|
90
|
-
Choose a command that
|
|
92
|
+
Choose a command that **compiles and tests only** what differs from `origin/dev`, so it finishes in a minute
|
|
93
|
+
or two — and that runs **no code rules** (not an nx `ci` target, which runs `architecture:validate-code`).
|
|
94
|
+
The merged tree holds every other developer's published copy, so rules run there judge their code as your
|
|
95
|
+
change: one copy's oversized method would fail everybody else's publish. The rules already ran against main
|
|
96
|
+
in the first build.
|
|
91
97
|
|
|
92
98
|
## Merge automation and existing authorization
|
|
93
99
|
|
|
@@ -306,8 +306,9 @@ snapshots are never loaded as active summaries; a new PR requires its own author
|
|
|
306
306
|
8. **`pnpm wp-start-push-dev`** — stage ① of publishing to the shared dev server: bring this branch up to
|
|
307
307
|
date with `origin/main` (the same 3-point merge as `wp-start-update`), ONLY if it is behind. No PR is
|
|
308
308
|
opened. See below.
|
|
309
|
-
9. **`pnpm wp-build-push-dev`** — stage ②:
|
|
310
|
-
`
|
|
309
|
+
9. **`pnpm wp-build-push-dev`** — stage ②: build this branch alone against main
|
|
310
|
+
(`commands.pr-gate.buildCommand`, code rules ON), then check it against `origin/dev` on a throwaway merge,
|
|
311
|
+
`pnpm install`, and run `commands.push-dev.buildCommand` (compile + tests only). Publishes nothing.
|
|
311
312
|
10. **`pnpm wp-finish-push-dev`** — stage ③: publish the copy stage ② verified as `dev-include/<branch>`.
|
|
312
313
|
Also `--list` (what is in the pool) and `--remove` (the rollback).
|
|
313
314
|
|
|
@@ -321,7 +322,8 @@ Publishing is three stages, the same shape as the PR flow:
|
|
|
321
322
|
```bash
|
|
322
323
|
pnpm wp-start-push-dev # ① 3-point merge from origin/main — ONLY if your branch is behind it
|
|
323
324
|
# conflict → resolve with /wp-merge, then go on to ②
|
|
324
|
-
pnpm wp-build-push-dev # ②
|
|
325
|
+
pnpm wp-build-push-dev # ② build your branch vs main (rules ON), then merge origin/dev into a
|
|
326
|
+
# throwaway, pnpm install, run the dev build (compile + tests only)
|
|
325
327
|
# conflict → resolve on the throwaway, `git add`, re-run ②
|
|
326
328
|
pnpm wp-finish-push-dev # ③ publish the copy ② verified as dev-include/<your-branch>
|
|
327
329
|
|
|
@@ -344,12 +346,25 @@ conflict is resolved with `/wp-merge` on your own branch; `wp-build-push-dev` th
|
|
|
344
346
|
finalizes that merge before anything else. `wp-build-push-dev` refuses a branch that is still behind
|
|
345
347
|
`origin/main`, naming `wp-start-push-dev`.
|
|
346
348
|
|
|
347
|
-
**② What `wp-build-push-dev` checks
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
349
|
+
**② What `wp-build-push-dev` checks — two builds, two questions.**
|
|
350
|
+
|
|
351
|
+
| build | tree | runs | answers |
|
|
352
|
+
|---|---|---|---|
|
|
353
|
+
| 1 | your branch alone (it contains the latest main) | `commands.pr-gate.buildCommand` — code rules ON, affected vs main | would the PR gate let this land? |
|
|
354
|
+
| 2 | your branch merged with `origin/dev`, on a throwaway | `commands.push-dev.buildCommand` — compile + tests ONLY, affected vs `origin/dev` | does everyone's code still compile and pass together? |
|
|
355
|
+
|
|
356
|
+
Build 1 is the same thing the PR gate will judge, so you learn early what would block landing, and the
|
|
357
|
+
rules only ever judge what will actually land on main. Build 2 must NOT run the code rules: the merged tree
|
|
358
|
+
holds every other developer's copy, and diffed against main their code would be judged as yours — one
|
|
359
|
+
copy's oversized method would fail everybody else's publish. Its compile/test is mostly nx cache hits from
|
|
360
|
+
build 1.
|
|
361
|
+
|
|
362
|
+
For build 2 it fetches `origin/dev`, merges it into a THROWAWAY branch (`<your-branch>DevResolve`, never
|
|
363
|
+
your branch), runs `pnpm install` — other copies on dev can add workspace packages main does not have yet —
|
|
364
|
+
and runs `commands.push-dev.buildCommand` on the merged tree. So a conflict or a broken build is found on
|
|
365
|
+
your machine instead of after the shared composition fails. Each build's output goes to a log file; read
|
|
366
|
+
the `FullLog :` path it prints rather than re-running it. When both are green it records the copy it
|
|
367
|
+
verified and puts you back on your branch.
|
|
353
368
|
|
|
354
369
|
**What ③ publishes is never that merge.** The copy is your branch exactly as it is, plus — only when
|
|
355
370
|
something conflicted — ONE commit holding the files you resolved. A copy that contained `dev` would carry
|
|
@@ -358,10 +373,11 @@ every other copy's history, and a later `--remove` of one of them would leave it
|
|
|
358
373
|
copy (leased against the sha ② saw), so the push event carries the previous copy's sha.
|
|
359
374
|
|
|
360
375
|
**`commands.push-dev.buildCommand` has no default.** Configure the dev-scoped build in
|
|
361
|
-
`webpieces.config.json`
|
|
376
|
+
`webpieces.config.json` — compile and test only what differs from `origin/dev`, with NO code rules (not an
|
|
377
|
+
nx `ci` target, which runs `architecture:validate-code`):
|
|
362
378
|
|
|
363
379
|
```json
|
|
364
|
-
"commands": { "push-dev": { "buildCommand": "pnpm nx affected
|
|
380
|
+
"commands": { "push-dev": { "buildCommand": "pnpm nx affected -t build test --base=origin/dev --head=HEAD" } }
|
|
365
381
|
```
|
|
366
382
|
|
|
367
383
|
Without it, `wp-build-push-dev` refuses before touching anything and prints that entry. When `origin/dev`
|
|
@@ -432,7 +448,14 @@ tells you the machinery finished. Answer them in that order, and report both.
|
|
|
432
448
|
|
|
433
449
|
### When `wp-build-push-dev` stops on a conflict with dev
|
|
434
450
|
|
|
435
|
-
|
|
451
|
+
First it resolves, by itself, every conflicted file whose dev side comes ONLY from copies already on
|
|
452
|
+
`origin/main` — a copy whose branch has a merged PR, or whose content of that file main already holds. That
|
|
453
|
+
is the copy that was published, then landed on main with different content (review commits, a squash):
|
|
454
|
+
`dev` still holds its old version, and your branch carries its final one, so your side is taken and the
|
|
455
|
+
landed copy it overrode is named in the output. Nothing is lost and nothing is redeployed. Any file another
|
|
456
|
+
LIVE copy also changes is left for you.
|
|
457
|
+
|
|
458
|
+
It stops on the THROWAWAY branch and lists the files that remain. Resolve them, `git add` each one, then:
|
|
436
459
|
|
|
437
460
|
```bash
|
|
438
461
|
pnpm wp-build-push-dev # commits the resolution, pnpm install, runs the dev build
|