@xynogen/pix-skills 0.8.4 → 0.8.5

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/README.md CHANGED
@@ -145,6 +145,7 @@ as `/skill:<name>` slash commands.
145
145
  | `audit` | Security audit, integrity check, and secret/vulnerability scan |
146
146
  | `bootstrap` | Project and tool scaffolding from authoritative docs |
147
147
  | `brainstorm` | Design exploration and spec refinement before implementation |
148
+ | `cicd` | Set up a two-stage CI/CD release pipeline (validate on push/PR, publish on tag) across GitHub/Forgejo/GitLab |
148
149
  | `clone` | Clone any git repo into `/tmp/clones` for read-only exploration |
149
150
  | `command-runner` | Inspect workspace health using pre-populated git context (status + diff) |
150
151
  | `commit` | Split, write, and maintain Conventional-Commit-style commits |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xynogen/pix-skills",
3
- "version": "0.8.4",
3
+ "version": "0.8.5",
4
4
  "description": "Pi extension — agent skill loader (skill tool + skills bundle)",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/skills/cicd.md ADDED
@@ -0,0 +1,126 @@
1
+ ---
2
+ name: cicd
3
+ description: Set up a two-stage CI/CD release pipeline (validate on push/PR, publish on tag) for any language and most git-hosting platforms — GitHub Actions, Forgejo/Gitea Actions, GitLab CI. Use only on explicit request — "set up CI/CD", "add a release pipeline", "wire up publishing".
4
+ disable-model-invocation: true
5
+ ---
6
+ # CI/CD Release Pipeline Directive
7
+
8
+ ## Goal
9
+
10
+ Two stages, one invariant. **CI** validates every push/PR (fast) and can build+upload the artifact. **Publish** (on a version tag) re-runs the same CI, then downloads that exact artifact and ships it — never rebuilds.
11
+
12
+ **Golden rule: the artifact tested in CI is the exact artifact published.** Everything else is optimization around that invariant. Rebuilding at publish time voids it — the bytes you ship were never tested.
13
+
14
+ ```text
15
+ push/PR ──► ci (lint · test:latest · build+upload artifact)
16
+ tag vX.Y ──► publish ──┬─ ci (full: lint · test:full grid · build+upload)
17
+ └─ download artifact ─► auth ─► registry
18
+ ```
19
+
20
+ Do not scaffold projects (`bootstrap`) or retrofit lint/type gates (`harden`) — this is only the release pipeline. It assumes a working test/gate command already exists; if not, stop and point at `harden`.
21
+
22
+ ## Phase 1: Detect (read-only)
23
+
24
+ - **Platform** — GitHub Actions (`.github/workflows/`), Forgejo/Gitea Actions (`.forgejo/workflows/` or `.gitea/workflows/`), GitLab CI (`.gitlab-ci.yml`), Woodpecker, Drone. This decides syntax and which security features exist (see matrix below).
25
+ - **Language + registry** — what gets published and where (npm, PyPI, crates.io, Maven Central, container registry, GitHub/Gitea Releases).
26
+ - **Existing gate** — the local command that lints+tests. CI must call this exact command, never a diverging copy.
27
+ - **Build + artifact naming** — the build command and the dist path/glob.
28
+ - **Verify, don't recall** — confirm action versions, registry auth mechanisms, and CLI flags via docs/`--help` before writing. These move fast.
29
+
30
+ ## Phase 2: Propose
31
+
32
+ Present the plan before writing any workflow file: platform, the two files, publish trigger (tag vs release), auth mechanism (OIDC vs token — see matrix), and dependency-bot choice. Get approval. Publishing is irreversible; the pipeline that does it needs sign-off.
33
+
34
+ ## Phase 3: Apply
35
+
36
+ ### 1. One callable CI file, matrix toggle
37
+
38
+ ```yaml
39
+ on:
40
+ workflow_call: # lets publish reuse this exact file
41
+ inputs: { full: { type: boolean, default: false } }
42
+ push: { branches: [main] }
43
+ pull_request: { branches: [main] }
44
+ ```
45
+
46
+ - Matrix widens under `full` — the cheap subset on push, the full support grid on release. The axis is whatever the project supports: language/runtime versions, OS, or toolchain versions.
47
+ `matrix: { v: ${{ inputs.full && fromJSON('["a","b","c"]') || fromJSON('["c"]') }} }`
48
+ - `fail-fast: false` — one cell failing must not hide the others.
49
+ - **Lint in its own job**, once — it is version-independent, don't pay for it per matrix cell.
50
+ - **Build+upload job** runs the build, validates package metadata with the ecosystem's own check (`npm pack --dry-run`, `cargo package`, `twine check`, `mvn verify`, `go vet`/`goreleaser --snapshot`, `docker build`), and uploads the built artifact.
51
+
52
+ ### 2. Publish reuses CI, downloads the artifact
53
+
54
+ ```yaml
55
+ jobs:
56
+ ci: { uses: ./<workflows-dir>/ci.yml, with: { full: true } } # path per platform
57
+ publish:
58
+ needs: ci
59
+ environment: release # scopes trust + optional manual-approval gate
60
+ permissions: { id-token: write } # only where OIDC is used
61
+ steps:
62
+ - { uses: <download-artifact@SHA> } # never a rebuild step here
63
+ - { uses: <registry-publish@SHA> }
64
+ ```
65
+
66
+ ### 3. Harden every workflow
67
+
68
+ - **Least privilege** — top-level `permissions: {}`; grant per job (`contents: read`, and `id-token: write` only on publish).
69
+ - **`persist-credentials: false`** on checkout so no git token lingers on the runner.
70
+ - **Pin actions to a commit SHA** with a `# vX.Y.Z` comment — mutable tags (`@v5`) can be swapped under you. Resolve: `git ls-remote https://.../<action> refs/tags/vX.Y.Z`. (GitLab CI: pin images by `@sha256:` digest instead.)
71
+ - **Concurrency cancel on CI only** — `group: ci-${{ github.ref }}`, `cancel-in-progress: true`. **Never on publish** — do not interrupt a release mid-flight.
72
+
73
+ ### 4. Auth to the registry
74
+
75
+ Prefer **OIDC / trusted publishing** where the platform+registry pair supports it — no long-lived token in secrets; the CI mints a short-lived one the registry trusts. Register the trusted publisher on the registry side once, out of band (owner/repo + workflow file + environment). Where OIDC is unavailable, fall back to a **scoped, expiring token** in the platform's secret store, granted only to the publish job/environment.
76
+
77
+ ### 5. Keep pins fresh
78
+
79
+ A dependency bot rotates SHA pins so they don't rot, with a cooldown to skip brand-new (possibly compromised) releases. **This is the least portable piece** — pick by platform (matrix below).
80
+
81
+ ## Platform compatibility matrix
82
+
83
+ | Concern | GitHub | Forgejo / Gitea Actions | GitLab CI |
84
+ |---|---|---|---|
85
+ | Workflow dir | `.github/workflows/` | `.forgejo/` or `.gitea/workflows/` | `.gitlab-ci.yml` |
86
+ | Syntax | Actions YAML | **Actions-compatible** (most `uses:` run) | GitLab pipeline YAML (different model) |
87
+ | Reusable CI | `workflow_call` | `workflow_call` (recent versions) | `include:` + `extends`/`!reference` |
88
+ | OIDC publish | ✅ broad (PyPI/npm/…) | ⚠️ limited/emerging → use a scoped token | ✅ (id_tokens) for supported registries |
89
+ | `permissions`/`id-token` | ✅ | ✅ (version-dependent) | via `id_tokens:` keyword |
90
+ | Dependabot | ✅ native | ❌ **not supported** | ❌ native, but has its own scanners |
91
+ | Dependency-bot fallback | Dependabot | **Renovate** (self-host or Mend; supports Gitea/Forgejo) | **Renovate**, or GitLab's dep scanning |
92
+ | Pin actions by SHA | ✅ | ✅ | pin images by `@sha256:` digest |
93
+
94
+ **Portability rules:**
95
+
96
+ - The *shape* (validate → tag → reuse-CI → publish-tested-artifact) is identical everywhere. Only trigger syntax, auth, and the bot change.
97
+ - Do **not** assume Dependabot — it is GitHub-only. On Forgejo/Gitea/GitLab use Renovate. State the choice in Phase 2.
98
+ - Do **not** assume OIDC — check the platform+registry pair. Fall back to a scoped token and say so.
99
+ - Forgejo/Gitea Actions runs most GitHub actions, but SHA-pinned third-party actions must be reachable from that instance's configured registry (often a GitHub mirror) — verify before relying on one.
100
+
101
+ ## Phase 4: Verify + Report
102
+
103
+ - Trigger CI on a branch/PR — must go green.
104
+ - Do a dry-run publish if the registry offers one (`npm publish --dry-run`, `cargo publish --dry-run`, TestPyPI, a staging registry) before a real tag.
105
+ - Confirm the publish job **downloads** the artifact and has no build step.
106
+ - Confirm CI runs the same gate command as local.
107
+
108
+ ```text
109
+ ## Pipeline: [project]
110
+ **Platform:** [GitHub/Forgejo/GitLab]
111
+ **CI:** [file] — push/PR fast, workflow_call full
112
+ **Publish:** [file] — trigger [tag/release], auth [OIDC/token], environment [name]
113
+ **Artifact:** built once in CI, downloaded at publish (no rebuild)
114
+ **Pins:** actions @SHA · deps via [Dependabot/Renovate]
115
+ ```
116
+
117
+ ## Red Flags — STOP
118
+
119
+ - A build/compile step inside the publish job — it must download the CI artifact. This breaks the golden rule.
120
+ - Publish not gated on a green CI run of the tagged commit.
121
+ - Long-lived registry token in secrets when OIDC is available for that platform+registry.
122
+ - `permissions: write-all` or a token persisted on the runner.
123
+ - Mutable action tags (`@v5`) instead of SHA pins.
124
+ - Concurrency cancellation on the publish workflow.
125
+ - Assuming Dependabot on a non-GitHub host, or OIDC without verifying the registry supports it.
126
+ - CI command that diverges from the local gate.