@lifeaitools/rdc-skills 0.9.37 → 0.10.0

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.
@@ -0,0 +1,289 @@
1
+ ---
2
+ type: spec
3
+ role: publish-md
4
+ systems: [deploy, release, plan]
5
+ schema_version: "1.0"
6
+ tags: [publish-md, spec, rdc-skills]
7
+ ---
8
+ # PUBLISH.md — Authoritative Specification
9
+ > Version: 1.0 | Effective: 2026-05-22
10
+ > Architectural approval: 2026-05-22 interview (Option A — Full Rollout)
11
+
12
+ Every deployable target in the RDC ecosystem MAY carry a `PUBLISH.md` file
13
+ in its root directory. Skills that deploy, release, and plan read this file
14
+ to derive watch paths, surface metadata, and promotion gates.
15
+
16
+ ---
17
+
18
+ ## Schema
19
+
20
+ A `PUBLISH.md` file consists of two parts:
21
+
22
+ 1. **YAML frontmatter** — app-level metadata, bounded by `---` delimiters.
23
+ 2. **One or more surface sections** — per-surface metadata, bounded by
24
+ HTML comment markers (`<!-- SURFACE:<name> -->` … `<!-- /SURFACE:<name> -->`).
25
+
26
+ Frontmatter is authoritative. Surface sections are the publish manifest.
27
+
28
+ ---
29
+
30
+ ## Frontmatter Fields
31
+
32
+ All fields are required unless marked optional.
33
+
34
+ ```yaml
35
+ ---
36
+ schema_version: "1.0" # (required) always "1.0" for this revision
37
+ entity_slug: <slug> # (required) matches app_deployments.app_slug
38
+ artifact_type: <type> # (required) one of: website | api | package | worker | mcp-server
39
+ environments: [dev] # (required) array; subset of: dev, prod
40
+ status: active # (required) one of: active | draft | deprecated
41
+ notes: "" # (optional) free-text, ignored by validator
42
+ ---
43
+ ```
44
+
45
+ ### Field Reference
46
+
47
+ | Field | Type | Required | Allowed Values |
48
+ |-------|------|----------|---------------|
49
+ | `schema_version` | string | yes | `"1.0"` |
50
+ | `entity_slug` | string | yes | must match `app_deployments.app_slug` |
51
+ | `artifact_type` | string | yes | `website` · `api` · `package` · `worker` · `mcp-server` |
52
+ | `environments` | string[] | yes | subset of `[dev, prod]`; at least one required |
53
+ | `status` | string | yes | `active` · `draft` · `deprecated` |
54
+ | `notes` | string | no | free-text annotation |
55
+
56
+ #### `environments` semantics
57
+
58
+ - `[dev]` — surface is only available on the PM2 dev server
59
+ - `[prod]` — surface is only available on the Coolify production instance
60
+ - `[dev, prod]` — surface exists in both tiers
61
+
62
+ The validator enforces: each value in `environments` must match an
63
+ `app_deployments.environment` row for the same `entity_slug`.
64
+
65
+ #### `status` semantics
66
+
67
+ - `active` — `rdc:release` promotion is allowed
68
+ - `draft` — `rdc:release` will block and print a warning; dev deploy is allowed
69
+ - `deprecated` — `rdc:release` will block; validator flags as warn
70
+
71
+ ---
72
+
73
+ ## Surface Sections
74
+
75
+ Each deployable surface gets one managed section inside the PUBLISH.md body.
76
+ Sections are bounded by HTML comment markers so skills can read and rewrite
77
+ them without clobbering hand-authored prose.
78
+
79
+ ```
80
+ <!-- SURFACE:<name> -->
81
+ path: /
82
+ source_dir: apps/baru-website
83
+ build_type: nextjs
84
+ visibility: public
85
+ cache: no-store
86
+ watch_paths:
87
+ - apps/baru-website/**
88
+ - packages/ui/**
89
+ - packages/supabase/**
90
+ <!-- /SURFACE:<name> -->
91
+ ```
92
+
93
+ ### Surface Field Reference
94
+
95
+ | Field | Type | Required | Description |
96
+ |-------|------|----------|-------------|
97
+ | `path` | string | yes | URL path prefix served by this surface (e.g. `/`, `/api`) |
98
+ | `source_dir` | string | yes | Monorepo-relative path to the source directory |
99
+ | `build_type` | string | yes | `nextjs` · `static` · `docker` · `node` · `edge` |
100
+ | `visibility` | string | yes | `public` · `private` · `internal` |
101
+ | `cache` | string | yes | HTTP cache directive: `no-store` · `immutable` · `stale-while-revalidate` · `max-age=N` |
102
+ | `watch_paths` | string[] | yes | gitignore-style globs; at least one required. These are unioned to derive Coolify `watch_paths`. |
103
+ | `artifact_id` | string | no | Stable ID for `artifact_registry` upserts; defaults to `<entity_slug>/<name>` |
104
+
105
+ ### `<name>` convention
106
+
107
+ The surface name appears in the comment markers and must be a short,
108
+ lowercase, hyphen-separated identifier that describes the surface:
109
+
110
+ - `website` — primary web UI
111
+ - `api` — REST/GraphQL API
112
+ - `mcp` — Model Context Protocol server endpoint
113
+ - `worker` — background worker or cron
114
+ - `static` — purely static asset serving
115
+
116
+ Multiple surfaces are allowed per file (e.g. a Next.js app that also exposes
117
+ an API surface under `/api`).
118
+
119
+ ---
120
+
121
+ ## Environments Array
122
+
123
+ The top-level `environments` field declares which deployment tiers host this app.
124
+ Each surface inherits the app-level `environments` unless overridden at the
125
+ surface level (not supported in schema v1.0 — planned for v1.1).
126
+
127
+ Validator enforcement:
128
+ 1. At least one environment must be declared.
129
+ 2. Each declared environment must be one of `dev` or `prod`.
130
+ 3. Each declared environment must have a corresponding `app_deployments` row for the `entity_slug`.
131
+
132
+ `rdc:deploy` uses `environments` to determine whether a dev or prod deploy is
133
+ appropriate for the given target. `rdc:release` requires `prod` to be present
134
+ before promoting.
135
+
136
+ ---
137
+
138
+ ## Opt-out (File Absence)
139
+
140
+ **PUBLISH.md absence = opt-out.** There is no sentinel field, no `publish: false`.
141
+
142
+ A deployable target without a `PUBLISH.md`:
143
+ - Is skipped by `rdc:deploy`'s watch-paths derivation step.
144
+ - Is NOT inserted into `artifact_registry` on deploy.
145
+ - Is flagged as a **warn** (not fail) by the validator during the Option A rollout period.
146
+ - Will become a **fail** once the rollout is complete (controlled by the `--strict` flag on the validator).
147
+
148
+ Packages and libraries that are not independently deployed (e.g. `@regen/ui`)
149
+ do not require a `PUBLISH.md`. Only targets with a row in `app_deployments` are in scope.
150
+
151
+ ---
152
+
153
+ ## Validator Contract
154
+
155
+ The validator (`scripts/validate-publish-manifests.js`) operates in two modes:
156
+
157
+ ### Warn mode (default, during rollout)
158
+
159
+ In warn mode the validator:
160
+ - Queries `app_deployments` for all `status = 'active'` rows.
161
+ - For each row, checks whether a `PUBLISH.md` exists at the expected path.
162
+ - For rows without `PUBLISH.md`: emits a `WARN` line and continues.
163
+ - For rows WITH `PUBLISH.md`: parses YAML frontmatter and validates all required fields.
164
+ - If frontmatter is invalid (missing required field, bad enum value): emits a `FAIL` line.
165
+ - Exits 0 if there are no `FAIL` lines (warns are non-fatal in this mode).
166
+
167
+ ### Strict mode (`--strict`)
168
+
169
+ In strict mode:
170
+ - Missing `PUBLISH.md` is treated as `FAIL`, not `WARN`.
171
+ - Exits non-zero if any registered active app is missing a manifest.
172
+ - Used in CI after Option A rollout is complete.
173
+
174
+ ### Field validation rules
175
+
176
+ | Check | Fail condition |
177
+ |-------|---------------|
178
+ | `schema_version` present | missing or not `"1.0"` |
179
+ | `entity_slug` present | missing or empty string |
180
+ | `artifact_type` present | missing or not in allowed set |
181
+ | `environments` present | missing, empty array, or contains unknown value |
182
+ | `status` present | missing or not in allowed set |
183
+ | At least one surface section | no `<!-- SURFACE: -->` markers found |
184
+ | `watch_paths` non-empty | surface section has no `watch_paths` entries |
185
+
186
+ ---
187
+
188
+ ## Consumer Skills
189
+
190
+ ### `rdc:deploy`
191
+
192
+ Reads PUBLISH.md during the deploy pre-flight step:
193
+
194
+ 1. Locates `PUBLISH.md` in the app's `source_dir`.
195
+ 2. Parses YAML frontmatter — fails deploy if invalid.
196
+ 3. Unions all `watch_paths` across surface sections.
197
+ 4. Updates `app_deployments.watch_paths` with the union.
198
+ 5. After a successful deploy, calls `storeArtifact` (INSERT into `artifact_registry`) for each surface section.
199
+
200
+ If `PUBLISH.md` is absent, `rdc:deploy` skips steps 2–5 and proceeds with the deploy without watch-path derivation.
201
+
202
+ ### `rdc:release`
203
+
204
+ Reads PUBLISH.md during the promotion pre-flight gate:
205
+
206
+ 1. Locates `PUBLISH.md` in the app's `source_dir`.
207
+ 2. Checks `status` field — blocks promotion if `status != "active"`.
208
+ 3. Checks `environments` array — blocks promotion if `prod` is not declared.
209
+ 4. If checks pass, proceeds with Coolify promotion.
210
+
211
+ ### `rdc:plan`
212
+
213
+ When scaffolding a new app, reads the `PUBLISH.md.template` from
214
+ `scaffold/templates/` and hydrates it with the app's metadata to produce
215
+ a starter `PUBLISH.md` in the new app directory.
216
+
217
+ ---
218
+
219
+ ## Example PUBLISH.md — baru-website
220
+
221
+ ```markdown
222
+ ---
223
+ schema_version: "1.0"
224
+ entity_slug: baru-website
225
+ artifact_type: website
226
+ environments: [dev]
227
+ status: active
228
+ notes: "Baru.dev — reference implementation for PUBLISH.md convention"
229
+ ---
230
+
231
+ # baru-website
232
+
233
+ <!-- SURFACE:website -->
234
+ path: /
235
+ source_dir: apps/baru-website
236
+ build_type: nextjs
237
+ visibility: public
238
+ cache: no-store
239
+ watch_paths:
240
+ - apps/baru-website/**
241
+ - packages/ui/**
242
+ - packages/supabase/**
243
+ <!-- /SURFACE:website -->
244
+ ```
245
+
246
+ ---
247
+
248
+ ## Example PUBLISH.md — regen-media MCP server
249
+
250
+ ```markdown
251
+ ---
252
+ schema_version: "1.0"
253
+ entity_slug: regen-media
254
+ artifact_type: mcp-server
255
+ environments: [dev, prod]
256
+ status: active
257
+ notes: "Regen Media MCP — R2 image library, Flux/MJ generation, embeddings"
258
+ ---
259
+
260
+ # regen-media
261
+
262
+ <!-- SURFACE:mcp -->
263
+ path: /mcp
264
+ source_dir: mcp-servers/regen-media
265
+ build_type: docker
266
+ visibility: internal
267
+ cache: no-store
268
+ watch_paths:
269
+ - mcp-servers/regen-media/**
270
+ <!-- /SURFACE:mcp -->
271
+
272
+ <!-- SURFACE:api -->
273
+ path: /api
274
+ source_dir: mcp-servers/regen-media
275
+ build_type: docker
276
+ visibility: private
277
+ cache: no-store
278
+ watch_paths:
279
+ - mcp-servers/regen-media/**
280
+ <!-- /SURFACE:api -->
281
+ ```
282
+
283
+ ---
284
+
285
+ ## Changelog
286
+
287
+ | Version | Date | Change |
288
+ |---------|------|--------|
289
+ | 1.0 | 2026-05-22 | Initial spec — OQ-1/OQ-2/OQ-3 resolved; Option A Full Rollout approved |
@@ -1,18 +1,18 @@
1
1
  #!/usr/bin/env node
2
- // Hard blocks session if CWD is not the regen-root project directory.
2
+ // Hard blocks session if CWD is not the expected project directory.
3
3
  // Exits with code 1 to fail the hook + outputs a blocking systemMessage.
4
4
 
5
5
  const { execSync } = require('child_process');
6
6
  const hookLog = require('./hook-logger');
7
7
  const cwd = process.cwd().replace(/\\/g, '/');
8
8
 
9
- let expected = 'regen-root';
9
+ let expected = process.env.RDC_PROJECT_SCOPE || 'regen-root';
10
10
  try {
11
11
  expected = execSync('git rev-parse --show-toplevel', { encoding: 'utf8', stdio: 'pipe' })
12
12
  .trim().replace(/\\/g, '/');
13
13
  } catch (_) {}
14
14
 
15
- if (!cwd.endsWith('regen-root')) {
15
+ if (!cwd.endsWith(expected)) {
16
16
  hookLog('check-cwd', 'SessionStart', 'block', { cwd, expected });
17
17
  process.stdout.write(JSON.stringify({
18
18
  systemMessage:
@@ -5,7 +5,7 @@
5
5
  * Fires on every Stop event where Claude decided to end_turn.
6
6
  * Queries get_open_epics() via Supabase REST.
7
7
  * Only blocks if epics with status=todo exist — in_progress means another session owns them.
8
- * Only fires in the regen-root project (scope guard on event.cwd).
8
+ * Only fires in the configured project scope (scope guard on event.cwd).
9
9
  *
10
10
  * Exit codes:
11
11
  * 0 = allow stop
@@ -15,8 +15,9 @@
15
15
  * NEXT_PUBLIC_SUPABASE_URL=https://<ref>.supabase.co
16
16
  * NEXT_PUBLIC_SUPABASE_ANON_KEY=<key>
17
17
  *
18
- * PROJECT SCOPE in package.json or plugin config:
19
- * "hookScope": "regen-root" folder name that must appear in event.cwd
18
+ * PROJECT SCOPE:
19
+ * RDC_PROJECT_SCOPE=<folder-name> folder name that must appear in event.cwd
20
+ * RDC_PROJECT_ROOT=<path> root used to find .rdc/overnight.lock and .env.local
20
21
  */
21
22
 
22
23
  const fs = require('fs');
@@ -24,11 +25,12 @@ const path = require('path');
24
25
 
25
26
  // ── Config — override these per project ──────────────────────────────────────
26
27
 
27
- const PROJECT_SCOPE = 'regen-root'; // only block in sessions inside this folder name
28
- const OVERNIGHT_SENTINEL = 'C:/Dev/regen-root/.rdc/overnight.lock'; // only fire when this exists
28
+ const PROJECT_SCOPE = process.env.RDC_PROJECT_SCOPE || 'regen-root'; // LIFEAI default; override per project
29
+ const PROJECT_ROOT = process.env.RDC_PROJECT_ROOT || process.cwd();
30
+ const OVERNIGHT_SENTINEL = process.env.RDC_OVERNIGHT_LOCK || path.join(PROJECT_ROOT, '.rdc', 'overnight.lock');
29
31
  const ENV_PATHS = [
30
- 'C:/Dev/regen-root/apps/rdc-marketing-engine/.env.local',
31
- 'C:/Dev/regen-root/.env.local',
32
+ ...(process.env.RDC_ENV_PATHS ? process.env.RDC_ENV_PATHS.split(path.delimiter) : []),
33
+ path.join(PROJECT_ROOT, '.env.local'),
32
34
  ];
33
35
  const SUPABASE_URL = process.env.SUPABASE_URL || readEnvVar('NEXT_PUBLIC_SUPABASE_URL');
34
36
 
@@ -18,10 +18,11 @@
18
18
 
19
19
  const fs = require('fs');
20
20
  const path = require('path');
21
+ const os = require('os');
21
22
  const hookLog = require('./hook-logger');
22
23
 
23
24
  const MARKER_FILE = path.join(
24
- process.env.USERPROFILE || process.env.HOME || 'C:/Users/DaveLadouceur',
25
+ process.env.USERPROFILE || process.env.HOME || os.homedir(),
25
26
  '.claude',
26
27
  'fixit.marker'
27
28
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifeaitools/rdc-skills",
3
- "version": "0.9.37",
3
+ "version": "0.10.0",
4
4
  "description": "RDC typed-agent dispatch skill suite for Claude Code - plan, build, review, overnight builds",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -19,15 +19,23 @@
19
19
  "type": "plugin",
20
20
  "skills": "skills/",
21
21
  "guides": "guides/",
22
- "version": "0.9.37",
22
+ "version": "0.10.0",
23
23
  "commands": "commands/"
24
24
  },
25
+ "bin": {
26
+ "rdc-skills-install": "scripts/install-rdc-skills.js",
27
+ "rdc-skills-self-test": "scripts/self-test.mjs"
28
+ },
25
29
  "scripts": {
26
30
  "install-rdc-skills": "node scripts/install-rdc-skills.js",
27
31
  "uninstall:win": "powershell -ExecutionPolicy Bypass -File scripts/uninstall.ps1",
28
32
  "uninstall:unix": "bash scripts/uninstall.sh",
29
33
  "validate": "node tests/validate-skills.js",
30
34
  "rdc-design": "node scripts/rdc-design-cli.mjs",
31
- "test:hooks": "node scripts/test-rdc-hooks.mjs"
35
+ "test:hooks": "node scripts/test-rdc-hooks.mjs",
36
+ "prepack": "node scripts/validate-publish-manifests.js --mode warn || true && node scripts/validate-place-histories.js --mode warn || true"
37
+ },
38
+ "devDependencies": {
39
+ "yaml": "^2.9.0"
32
40
  }
33
41
  }
@@ -0,0 +1,39 @@
1
+ ---
2
+ schema_version: "1.0"
3
+ prt_slug: "PRT_SLUG"
4
+ project_type: PROJECT_TYPE
5
+ location:
6
+ county: LOCATION_COUNTY
7
+ state: LOCATION_STATE
8
+ country: LOCATION_COUNTRY
9
+ parcel_apn: PARCEL_APN
10
+ area_acres: AREA_ACRES
11
+ centroid: [LAT, LNG]
12
+ acquired: "ACQUIRED_DATE"
13
+ steward: STEWARD_NAME
14
+ research_status: draft
15
+ last_reviewed: "LAST_REVIEWED_DATE"
16
+ contributors: []
17
+ ---
18
+
19
+ > This is a draft stub. Research pending. Status will be promoted to in-research once primary sources are identified.
20
+
21
+ ## Land lineage
22
+
23
+ TODO: Research land lineage of PROJECT_NAME. Cover indigenous stewardship, land grants, ownership transitions, and government survey references (PLSS township/range/section).
24
+
25
+ ## Stewardship transitions
26
+
27
+ TODO: Document major ownership and use transitions for PROJECT_NAME from earliest recorded title to present. Include conservation easements, deed restrictions, and use-change inflection points.
28
+
29
+ ## Ecological context
30
+
31
+ TODO: Document the ecoregion, watershed, soil classifications (NRCS Web Soil Survey), vegetation communities, water resources, wildlife corridors, and fire history for PROJECT_NAME.
32
+
33
+ ## Cultural significance
34
+
35
+ TODO: Research indigenous place names and cultural associations, historic structures, archaeological sites, community significance (grazing allotments, water rights, access traditions), and scenic values for PROJECT_NAME.
36
+
37
+ ## Regulatory record
38
+
39
+ TODO: Document zoning, conservation easements, water rights adjudications, federal and state permits, tax status, and any open title or lien issues of record for PROJECT_NAME.
@@ -0,0 +1,21 @@
1
+ ---
2
+ schema_version: "1.0"
3
+ entity_slug: "ENTITY_SLUG"
4
+ artifact_type: "ARTIFACT_TYPE"
5
+ environments: [dev]
6
+ status: draft
7
+ notes: ""
8
+ ---
9
+
10
+ # ENTITY_SLUG
11
+
12
+ <!-- SURFACE:website -->
13
+ path: /
14
+ source_dir: SOURCE_DIR
15
+ build_type: BUILD_TYPE
16
+ visibility: public
17
+ cache: no-store
18
+ watch_paths:
19
+ - SOURCE_DIR/**
20
+ - packages/ui/**
21
+ <!-- /SURFACE:website -->
@@ -766,8 +766,12 @@ async function main() {
766
766
  console.log('');
767
767
 
768
768
  if (!fs.existsSync(claudeHome)) {
769
- fail(`CLAUDE_HOME not found: ${claudeHome}`);
770
- process.exit(1);
769
+ fs.mkdirSync(claudeHome, { recursive: true });
770
+ warn(`CLAUDE_HOME did not exist — created ${claudeHome}`);
771
+ }
772
+ if (!fs.existsSync(settingsPath)) {
773
+ writeJson(settingsPath, {});
774
+ info(` created settings.json`);
771
775
  }
772
776
 
773
777
  // Read version + git SHA once