Tl deploy

From ITSalt/NaCl · View interactive version

Tl deploy is an AI agent skill from the GitHub repository ITSalt/NaCl. Monitor CI/CD deployment (GitHub Actions), run health checks, update YouGile. Deployment is triggered by git push (nacl-tl-ship), this skill monitors the result. Use when: deploy, check deploy status, verify deployment, or the user says "/nacl:tl-deploy".

How to use this skill

Skill file

Contract

Inputs this skill consumes:

Outputs this skill produces:

DEPLOY HALTED — {NO_INFRA | RUNNER_BROKEN | UNVERIFIED | BLOCKED}

Downstream consumers of this output:

Field schema each downstream consumer requires:

Headline:  DEPLOY COMPLETE
           DEPLOY HALTED — REGRESSION
           DEPLOY HALTED — NO_INFRA
           DEPLOY HALTED — RUNNER_BROKEN
           DEPLOY HALTED — UNVERIFIED
           DEPLOY HALTED — BLOCKED (clean-checkout-artifact-missing)
           DEPLOY HALTED — BLOCKED (clean-checkout-commit-mismatch)
           DEPLOY HALTED — BLOCKED (clean-checkout-<blocker_detail>)
           DEPLOY INCOMPLETE — UNVERIFIED (health probe timeout)
           DEPLOY HALTED — NO_INFRA (health contract undefined)

Per-task status table (one row per deployed SHA):
  SHA | source-task | source-verification-status | CI-status | health-status

Health-status values: PASS | FAIL | TIMEOUT | SKIPPED
CI-status values:     PASS | FAIL | SKIPPED
source-verification-status: done (PASS) | verified-pending (UNVERIFIED) | blocked | failed | not-found

Contract change discipline:

If this skill's output contract changes, every downstream consumer listed above

must be audited and updated in the same release. The 0.10.0→0.10.1 regression

was caused by the absence of this discipline. nacl-tl-fix changed its output

contract (new status vocabulary, new header strings, new Status: field)

without auditing nacl-tl-reopened and nacl-tl-hotfix, which were the only

two skills that consume its output. Had a ## Contract section existed in

nacl-tl-fix, the update would have included a list of downstream consumers,

making the audit mandatory and visible.


TeamLead Deploy — Monitor + Verify + YouGile

Your Role

You monitor deployments triggered by CI/CD pipelines (GitHub Actions) and verify they succeed. You do NOT trigger deploys directly — that happens via git push in /nacl:tl-ship. You watch the CI/CD pipeline, run health checks, and update YouGile.

Key Principle

Deploy is triggered by push (nacl-tl-ship does this).
This skill MONITORS the result and verifies health.
If health check fails → alert + suggest rollback.

Invocation

/nacl:tl-deploy --staging              # monitor staging deploy (feature branch push)
/nacl:tl-deploy --production           # monitor production deploy (main branch push)
/nacl:tl-deploy --watch                # watch currently running pipeline/workflow

Configuration Resolution

| Data | Source priority |

|------|---------------|

| Staging URL | config.yaml → deploy.staging.url |

| Production URL | config.yaml → deploy.production.url |

| Health endpoint | config.yaml → deploy.[env].health_endpoint (fallback: /api/health) |

| YouGile done column | config.yaml → yougile.columns.done |

| VPS staging | config.yaml → vps.staging (ip, user, ssh_key) — SSH-диагностика при сбое health-check |

| VPS production | config.yaml → vps.production (ip, user, ssh_key) — аналогично |

| Clean-checkout artifact | .tl/clean-checkout/<commit>.json — produced by nacl-tl-deliver Step 4b. Required for every deploy (W9). Absent / mismatch / BLOCKED without exception → DEPLOY HALTED — BLOCKED (clean-checkout-*). |

If deploy section missing → error (cannot monitor deployment without URL).

If YouGile missing → skip task moves, report locally.


Workflow: 5 Steps

Step 0: PLATFORM DETECTION

Detect CI/CD platform from the project:

  1. Check config.yaml → deploy.ci_platform (if set, use it)
  2. Check for .github/workflows/ directory → GitHub Actions (use gh)
  3. If neither → error: no CI/CD platform detected

| Platform | CLI | List runs | Watch run | View logs |

|----------|-----|-----------|-----------|-----------|

| GitHub Actions | gh | gh run list | gh run watch | gh run view --log-failed |

Step 1: IDENTIFY DEPLOYMENT

  1. Pre-monitor clean-checkout artifact gate (W9-ci-clean-checkout):

Before evaluating the upstream verification gate (0a), confirm that

a clean-checkout evidence artifact exists for the commit being

deployed.

```

commit = the SHA selected by Step 0 / Step 1.1

artifact = .tl/clean-checkout/<commit>.json (in the repo root

of the deploying workspace)

```

| Artifact state | Deploy action |

|---------------|---------------|

| Present, terminal_status: PASS, commit field matches the deployed SHA | Proceed to step 0a (upstream verification). |

| Present, commit field DOES NOT match the deployed SHA | HALT: DEPLOY HALTED — BLOCKED (clean-checkout-commit-mismatch). The wave-tip evidence is for a different commit; deploy refuses to ship a commit that was never clean-checkout-verified. |

| Present, terminal_status: BLOCKED, no signed exception covering the named blocker_detail | HALT: DEPLOY HALTED — BLOCKED (clean-checkout-<blocker_detail>). |

| Present, terminal_status: BLOCKED, signed exception covers blocker_detail | Proceed with a (clean-checkout-bypass) banner on the final report and an event in .tl/emergencies/ if the bypass route was emergency-mode (not exception). |

| Absent | HALT unconditionally: DEPLOY HALTED — BLOCKED (clean-checkout-artifact-missing). There is NO inline override flag. The operator must (a) re-run /nacl:tl-deliver (which produces the artifact in Step 4b) or (b) file a signed exception with affected_gates: [clean-checkout-artifact-missing] for a one-shot carve-out. |

The clean-checkout artifact is the gate-quality evidence that the

deployed commit was built + smoked from a fresh tree, not a warm

local cache. Without a matching artifact, deploy emits BLOCKED.

0a. Pre-monitor verification gate:

Before monitoring any pipeline, confirm the code being deployed came from

tasks with verified development status. Read from graph or status.json:

```cypher

// Find tasks associated with the commit SHA being deployed

MATCH (t:Task)

WHERE t.commit = $commitSha

RETURN t.id AS task_id, t.status AS status

```

Or read .tl/status.json and .tl/conductor-state.json to find tasks

associated with the branch/commit being deployed.

| Task status | Deploy action |

|-------------|--------------|

| done (PASS) | Proceed with deployment monitoring |

| verified-pending (UNVERIFIED) | HALT by default: DEPLOY HALTED — UNVERIFIED (upstream verified-pending). Operator override is permitted (explicit "yes" prompt; NOT auto-confirmed by --yes). On override → headline DEPLOY APPLIED — UNVERIFIED (operator override); Task.verification_skip_reason = 'deploy operator-override'; the source Task is NOT moved to done / released (Cross-cutting principle P4). |

| blocked | Same gate as UNVERIFIED. On override → DEPLOY APPLIED — UNVERIFIED (blocked, operator override); no source-task state movement. |

| failed / REGRESSION | HALT immediately: DEPLOY HALTED — REGRESSION. Do NOT proceed |

| Not found in graph | HALT unconditionally: DEPLOY HALTED — UNVERIFIED (upstream status unknown). The previous "Warn and proceed (backward-compat)" path is removed. The operator must populate the Task node (via the appropriate dev / fix / verify skill) and re-run; there is no override that promotes unknown to verified. |

  1. Read config.yaml → deploy for target environment config
  2. Find and watch the deploy pipeline via the single-authority helper (run selection,

watch, and outcome classification — shared with release/deliver; pinned by

${CLAUDE_PLUGIN_ROOT}/nacl-core/scripts/wait-for-ci.test.sh):

```bash

bash ${CLAUDE_PLUGIN_ROOT}/nacl-core/scripts/wait-for-ci.sh watch --branch {target_branch} --timeout "${ci_timeout:-600}"

# exit 0 → CI_OK | NO_CI (no .github/workflows) | NO_RUN ("no deployment in progress")

# exit 1 → CI_FAILED (the failed-log tail is already printed)

```

Step 2: ON CI FAILURE

If wait-for-ci.sh exited non-zero (CI_FAILED):

Step 3: HEALTH CHECK

After pipeline succeeds:

  1. Read health endpoint from config: config.yaml → deploy.[env].health_endpoint

(fallback: /api/health — allowed only if a health contract is also defined; see step 3 below)

  1. Read deploy URL: config.yaml → deploy.[env].url
  2. Read health contract from config: config.yaml → deploy.[env].health_contract

DEPLOY HALTED — NO_INFRA (health contract undefined)

Do NOT proceed. A 200 response with no shape contract is unverifiable.

  1. Poll for liveness (replaces fixed sleep):

DEPLOY INCOMPLETE — UNVERIFIED (health probe timeout)

  1. Validate response shape (required — HTTP 200 alone is not sufficient):

```bash

BODY=$(curl -s [url][health_endpoint])

# For each key in health_contract.expected_keys:

echo "$BODY" | jq --exit-status 'has("[key]")'

# For each entry in health_contract.expected_values:

echo "$BODY" | jq --exit-status '.[key] == [expected_value]'

```

  1. If shape validation passes → health-status = PASS. Proceed to Step 4.
  2. On any non-200 HTTP response during polling (not timeout): retry counts against the

60-second budget. After budget is exhausted → same DEPLOY INCOMPLETE headline.

  1. If the health endpoint never responds and config.yaml → vps.[env] is populated,

run SSH diagnostics before halting:

1. Connect: ssh -i {ssh_key} {user}@{ip}

2. Check process manager: pm2 status or docker ps

3. Check recent logs: journalctl -u app --since '5m ago' or docker logs --since 5m

4. Check resources: df -h, free -m

5. Include all findings in the failure report.

6. HALT pipeline with the diagnostic report. Do NOT proceed to Step 4 success path.

Step 4: YOUGILE UPDATE + REPORT

The report opens with a per-task status table. One row per deployed SHA.

Per-task verification status is required in every report; this is the single

source of truth that downstream readers consume.

Per-task status table (mandatory — include in every report):

| SHA     | source-task | source-verification-status | CI-status | health-status |
|---------|-------------|---------------------------|-----------|---------------|
| abc1234 | UC-042      | done (PASS)               | PASS      | PASS          |
| def5678 | TECH-007    | done (PASS)               | PASS      | PASS          |

Followed by the aggregated headline on a line by itself:

Headline: DEPLOY COMPLETE

On success (pipeline passed AND health check passed):

```

Deployed to [staging/production]

URL: https://example.com

Health: 200 OK

Version: 1.2.3

Commit: abc1234

Time: 2m 15s

Next: /nacl:tl-release (for production deploys)

```

On pipeline failure (Step 2):

or DEPLOY HALTED — {NO_INFRA | RUNNER_BROKEN} as appropriate

On health check failure (Step 3):

On pre-monitor gate halt (Step 1.0):

Without YouGile: Just report locally with headline.


CI/CD Pipeline Templates

GitHub Actions uses workflow files in .github/workflows/. Templates are in ${CLAUDE_PLUGIN_ROOT}/nacl-tl-core/templates/:

These are created during project setup by /nacl:tl-dev TECH-001 (infrastructure task) or by /nacl:init.

The templates are a Node/npm reference profile with unpinned versions. Before first use, fill ${NODE_VERSION} (and any image versions) from the project's own toolchain — config.yaml → modules.<m>.stack or the detected runtime — and replace ecosystem-specific steps if the project is not Node. NaCl never supplies a default version.


References

artifact produced by nacl-tl-deliver Step 4b (W9). Schema:

.tl/clean-checkout/_template.json.

upstream producer of the artifact this skill consumes.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.