Skip to content

Commit e52199b

Browse files
committed
docs: add update-deps documentation, fix hyperweb-io refs, add agent skill
- Update all GitHub URLs from hyperweb-io/makage to constructive-io/makage - Add comprehensive update-deps documentation to both READMEs - Document the cross-repo dependency update workflow and CI integration - Add .agents/skills/makage-overview/ with full CLI and update-deps reference
1 parent d0fc6ae commit e52199b

6 files changed

Lines changed: 230 additions & 17 deletions

File tree

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
---
2+
name: makage-overview
3+
description: Reference for the makage CLI tool — build helper, asset management, workspace updates, and cross-repo dependency synchronization. Use when asked about makage commands, monorepo builds, update-deps, or cross-repo dependency workflows.
4+
---
5+
6+
# makage
7+
8+
Tiny, zero-dependency build helper for monorepo packages. Replaces `cpy`, `rimraf`, and `copyfiles` with a single CLI.
9+
10+
**Source:** <https://github.com/constructive-io/makage>
11+
**npm:** `makage` (published from `packages/makage/dist`)
12+
13+
## CLI Commands
14+
15+
| Command | Description |
16+
|---------|-------------|
17+
| `makage build [--dev]` | Full build: clean + build-ts + assets. `--dev` adds `--declarationMap` |
18+
| `makage clean [path...]` | Remove directories (defaults to `dist`) |
19+
| `makage build-ts [--dev]` | TypeScript compilation for CJS + ESM |
20+
| `makage copy [...sources] <dest> [--flat] [--footer]` | Copy files with glob support |
21+
| `makage assets` | Copy LICENSE + package.json + README+FOOTER to dist |
22+
| `makage readme-footer --source <f> --footer <f> --dest <f>` | Concatenate README with footer |
23+
| `makage update-workspace` | Convert internal deps to `workspace:*` protocol |
24+
| `makage update-deps --from <source> --in <target>` | Cross-repo dependency detection (JSON output) |
25+
26+
## Cross-Repo Dependency Updates (`update-deps`)
27+
28+
### Purpose
29+
30+
Deterministic, version-aware dependency synchronization across repositories. This is the engine behind the [constructive-hub update-constructive-deps workflow](https://github.com/constructive-io/constructive-hub/blob/main/.github/workflows/update-constructive-deps.yml).
31+
32+
### Usage
33+
34+
```bash
35+
makage update-deps --from <path-to-source-workspace> --in <path-to-target-repo>
36+
```
37+
38+
### Algorithm
39+
40+
1. Reads `pnpm-workspace.yaml` from `--from` to discover all packages + versions
41+
2. Scans all `package.json` files in `--in` (supports workspace and non-workspace repos)
42+
3. Cross-references dependencies/devDependencies/peerDependencies/optionalDependencies
43+
4. Strips `^`/`~`/`>=` prefixes and compares semver parts numerically
44+
5. Skips `workspace:` protocol deps (always in sync)
45+
6. Outputs structured JSON to stdout; logs to stderr
46+
47+
### JSON Output Schema
48+
49+
```json
50+
{
51+
"sourcePackages": [{ "name": "string", "version": "string", "path": "string" }],
52+
"matchedPackages": [{
53+
"name": "string",
54+
"currentVersion": "string",
55+
"availableVersion": "string",
56+
"depType": "dependencies | devDependencies | peerDependencies | optionalDependencies",
57+
"consumer": "string",
58+
"outdated": "boolean"
59+
}],
60+
"outdatedPackages": [/* subset of matchedPackages where outdated=true */],
61+
"has_dep_changes": "boolean"
62+
}
63+
```
64+
65+
### CI Workflow Integration
66+
67+
The `update-constructive-deps` workflow in `constructive-hub` runs per target repo:
68+
69+
1. Checks out target repo + `constructive` workspace side by side
70+
2. Runs `makage update-deps --from ./constructive --in .`
71+
3. Parses JSON → extracts outdated package names
72+
4. **Workspace repos** (`constructive-db`, `dashboard`, `pgpm-modules`, `dev-utils`):
73+
- `echo "$OUTDATED_NAMES" | xargs pnpm update -r --latest`
74+
- `pnpm install --no-frozen-lockfile` (sync lockfile)
75+
- `pnpm -r build` (rebuild)
76+
5. **Non-workspace repos** (`sandbox-templates`, `pgpm-boilerplates`):
77+
- Per-directory: if lockfile exists → `pnpm update --latest $name`
78+
- If no lockfile → `jq` to set `^<version>` directly in `package.json`
79+
6. Creates branch `deps-update/<name-or-timestamp>` and opens PR
80+
7. For `constructive-db`: chains schema propagation via `repository_dispatch`
81+
82+
### Triggers
83+
84+
- **Manual** (`workflow_dispatch`): select which repos to update, optional PR name
85+
- **Automatic** (`repository_dispatch: constructive-published`): fires when constructive publishes
86+
87+
### Target Repos
88+
89+
| Repo | Type | Default |
90+
|------|------|---------|
91+
| `constructive-db` | workspace | enabled (also triggers schema propagation) |
92+
| `dashboard` | workspace | disabled |
93+
| `pgpm-modules` | workspace | disabled |
94+
| `dev-utils` | workspace | disabled |
95+
| `sandbox-templates` | non-workspace | disabled |
96+
| `pgpm-boilerplates` | non-workspace | disabled |
97+
98+
## Monorepo Conventions
99+
100+
makage assumes the following structure:
101+
102+
- Build output in `dist/`
103+
- pnpm workspace protocol for internal dependencies
104+
- `publishConfig.directory` set to `dist` in `package.json`
105+
- Shared `LICENSE` at monorepo root
106+
- Optional `FOOTER.md` per package (appended to README before publish)
107+
108+
## Key Files
109+
110+
| Path | Purpose |
111+
|------|---------|
112+
| `packages/makage/src/cli.ts` | CLI entrypoint and command dispatch |
113+
| `packages/makage/src/commands/updateDeps.ts` | Cross-repo dependency detection logic |
114+
| `packages/makage/src/commands/updateWorkspace.ts` | Workspace protocol updater |
115+
| `packages/makage/src/commands/build.ts` | Build orchestration |
116+
| `packages/makage/src/commands/copy.ts` | File copy with glob + flatten |
117+
| `packages/makage/src/commands/clean.ts` | Directory removal |
118+
| `packages/makage/src/commands/assets.ts` | Asset copy helper |
119+
| `packages/makage/src/commands/buildTs.ts` | TypeScript CJS + ESM compilation |
120+
| `packages/makage/src/commands/readmeFooter.ts` | README + FOOTER concatenation |

README.md

Lines changed: 67 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# makage
22

33
<p align="center">
4-
<img src="https://raw.githubusercontent.com/hyperweb-io/makage/refs/heads/main/docs/img/logo.svg" width="80">
4+
<img src="https://raw.githubusercontent.com/constructive-io/makage/refs/heads/main/docs/img/logo.svg" width="80">
55
<br />
66
Tiny build helper for monorepo packages
77
<br />
8-
<a href="https://github.com/hyperweb-io/makage/actions/workflows/ci.yml">
9-
<img height="20" src="https://github.com/hyperweb-io/makage/actions/workflows/ci.yml/badge.svg" />
8+
<a href="https://github.com/constructive-io/makage/actions/workflows/ci.yml">
9+
<img height="20" src="https://github.com/constructive-io/makage/actions/workflows/ci.yml/badge.svg" />
1010
</a>
11-
<a href="https://github.com/hyperweb-io/makage/blob/main/LICENSE">
11+
<a href="https://github.com/constructive-io/makage/blob/main/LICENSE">
1212
<img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg">
1313
</a>
1414
</p>
@@ -146,8 +146,69 @@ makage readme-footer --source README.md --footer FOOTER.md --dest dist/README.md
146146

147147
# Update workspace dependencies
148148
makage update-workspace
149+
150+
# Detect outdated cross-repo dependencies (structured JSON output)
151+
makage update-deps --from ./constructive --in .
152+
```
153+
154+
## Cross-Repo Dependency Updates (`update-deps`)
155+
156+
The `update-deps` command enables deterministic, version-aware dependency synchronization across repositories. It is the engine behind the [constructive-hub update-constructive-deps workflow](https://github.com/constructive-io/constructive-hub/blob/main/.github/workflows/update-constructive-deps.yml).
157+
158+
### How it works
159+
160+
1. **Discovers** all packages in a source pnpm workspace (by reading `pnpm-workspace.yaml`)
161+
2. **Scans** the target repo's `package.json` files (supports both monorepo and non-workspace layouts)
162+
3. **Cross-references** dependencies to find packages that exist in both source and target
163+
4. **Compares versions** using semver to identify outdated packages
164+
5. **Outputs structured JSON** to stdout for CI consumption (logs go to stderr)
165+
166+
### Usage
167+
168+
```bash
169+
makage update-deps --from <source-workspace> --in <target-repo>
170+
```
171+
172+
| Flag | Description |
173+
|------|-------------|
174+
| `--from` | Path to the source pnpm workspace (contains `pnpm-workspace.yaml`) |
175+
| `--in` | Path to the target repo to scan for outdated deps |
176+
177+
### Output format
178+
179+
```json
180+
{
181+
"sourcePackages": [{ "name": "@constructive/foo", "version": "1.2.3", "path": "packages/foo" }],
182+
"matchedPackages": [{ "name": "@constructive/foo", "currentVersion": "^1.1.0", "availableVersion": "1.2.3", "depType": "dependencies", "consumer": "@myapp/bar", "outdated": true }],
183+
"outdatedPackages": [/* subset of matchedPackages where outdated=true */],
184+
"has_dep_changes": true
185+
}
149186
```
150187

188+
### CI Integration
189+
190+
The `update-deps` command is used in GitHub Actions to automatically update downstream repos when the source workspace publishes new versions. The typical CI flow:
191+
192+
1. Check out the target repo + source workspace side by side
193+
2. Run `makage update-deps --from ./constructive --in .` for structured JSON detection
194+
3. Parse the JSON output to extract outdated package names
195+
4. Run `pnpm update -r --latest <packages...>` to update them
196+
5. Create a PR with the results
197+
198+
Target repos are categorized into two strategies:
199+
- **Workspace repos** (have `pnpm-workspace.yaml`): Use `pnpm update -r --latest` for bulk updates
200+
- **Non-workspace repos** (e.g., template repos): Update each `package.json` individually via `jq` or per-directory `pnpm update`
201+
202+
### Supported target repos
203+
204+
The constructive-hub workflow currently updates:
205+
- `constructive-db` (default, also triggers schema propagation)
206+
- `dashboard`
207+
- `pgpm-modules`
208+
- `dev-utils`
209+
- `sandbox-templates`
210+
- `pgpm-boilerplates`
211+
151212
## Documentation
152213

153214
For detailed usage and API documentation, see [packages/makage/README.md](./packages/makage/README.md).
@@ -159,7 +220,7 @@ For detailed usage and API documentation, see [packages/makage/README.md](./pack
159220
1. Clone the repository:
160221

161222
```bash
162-
git clone https://github.com/hyperweb-io/makage.git
223+
git clone https://github.com/constructive-io/makage.git
163224
```
164225

165226
2. Install dependencies:
@@ -180,7 +241,7 @@ pnpm test:watch
180241
## Credits
181242

182243
Built for developers, with developers.
183-
👉 https://launchql.com | https://hyperweb.io
244+
👉 https://constructive.io
184245

185246
## Disclaimer
186247

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"registry": "https://registry.npmjs.org",
1212
"command": {
1313
"create": {
14-
"homepage": "https://github.com/hyperweb-io/makage",
14+
"homepage": "https://github.com/constructive-io/makage",
1515
"license": "MIT",
1616
"access": "restricted"
1717
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"private": true,
66
"repository": {
77
"type": "git",
8-
"url": "https://github.com/hyperweb-io/makage"
8+
"url": "https://github.com/constructive-io/makage"
99
},
1010
"license": "MIT",
1111
"publishConfig": {

packages/makage/README.md

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# makage
22

33
<p align="center">
4-
<img src="https://raw.githubusercontent.com/hyperweb-io/makage/refs/heads/main/docs/img/logo.svg" width="80">
4+
<img src="https://raw.githubusercontent.com/constructive-io/makage/refs/heads/main/docs/img/logo.svg" width="80">
55
<br />
66
Tiny build helper for monorepo packages
77
<br />
8-
<a href="https://github.com/hyperweb-io/makage/actions/workflows/ci.yml">
9-
<img height="20" src="https://github.com/hyperweb-io/makage/actions/workflows/ci.yml/badge.svg" />
8+
<a href="https://github.com/constructive-io/makage/actions/workflows/ci.yml">
9+
<img height="20" src="https://github.com/constructive-io/makage/actions/workflows/ci.yml/badge.svg" />
1010
</a>
11-
<a href="https://github.com/hyperweb-io/makage/blob/main/LICENSE">
11+
<a href="https://github.com/constructive-io/makage/blob/main/LICENSE">
1212
<img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/>
1313
</a>
1414
</p>
@@ -248,6 +248,38 @@ This will:
248248
3. Update all dependencies, devDependencies, peerDependencies, and optionalDependencies
249249
4. Convert version numbers to `workspace:*` for internal packages
250250

251+
### `makage update-deps --from <source> --in <target>`
252+
253+
Detects outdated cross-repo dependencies by comparing a source pnpm workspace against a target repo. Outputs structured JSON to stdout for CI integration.
254+
255+
```bash
256+
makage update-deps --from ./constructive --in .
257+
```
258+
259+
| Flag | Description |
260+
|------|-------------|
261+
| `--from` | Path to the source pnpm workspace (must contain `pnpm-workspace.yaml`) |
262+
| `--in` | Path to the target repo to scan for outdated deps |
263+
264+
**How it works:**
265+
1. Reads `pnpm-workspace.yaml` from the source to discover all published packages and their versions
266+
2. Scans all `package.json` files in the target repo (workspace-aware or recursive scan)
267+
3. Cross-references `dependencies`, `devDependencies`, `peerDependencies`, and `optionalDependencies`
268+
4. Compares version strings (strips `^`/`~` prefixes) to determine what's outdated
269+
5. Outputs a JSON result with `sourcePackages`, `matchedPackages`, `outdatedPackages`, and `has_dep_changes`
270+
271+
**Output format:**
272+
```json
273+
{
274+
"sourcePackages": [{ "name": "@constructive/foo", "version": "1.2.3", "path": "packages/foo" }],
275+
"matchedPackages": [{ "name": "@constructive/foo", "currentVersion": "^1.1.0", "availableVersion": "1.2.3", "depType": "dependencies", "consumer": "@myapp/bar", "outdated": true }],
276+
"outdatedPackages": [/* subset where outdated=true */],
277+
"has_dep_changes": true
278+
}
279+
```
280+
281+
This command powers the [constructive-hub update-constructive-deps workflow](https://github.com/constructive-io/constructive-hub/blob/main/.github/workflows/update-constructive-deps.yml) which automatically creates PRs in downstream repos when the constructive workspace publishes new package versions.
282+
251283
## Why makage?
252284

253285
Most monorepo packages need the same basic build operations:
@@ -264,7 +296,7 @@ Instead of installing multiple dependencies (`cpy`, `rimraf`, etc.) in every pac
264296
1. Clone the repository:
265297

266298
```bash
267-
git clone https://github.com/hyperweb-io/makage.git
299+
git clone https://github.com/constructive-io/makage.git
268300
```
269301

270302
2. Install dependencies:
@@ -285,7 +317,7 @@ pnpm test:watch
285317
## Credits
286318

287319
Built for developers, with developers.
288-
👉 https://launchql.com | https://hyperweb.io
320+
👉 https://constructive.io
289321

290322
## Disclaimer
291323

packages/makage/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
"bin": {
1010
"makage": "cli.js"
1111
},
12-
"homepage": "https://github.com/hyperweb-io/makage",
12+
"homepage": "https://github.com/constructive-io/makage",
1313
"license": "MIT",
1414
"publishConfig": {
1515
"access": "public",
1616
"directory": "dist"
1717
},
1818
"repository": {
1919
"type": "git",
20-
"url": "https://github.com/hyperweb-io/makage"
20+
"url": "https://github.com/constructive-io/makage"
2121
},
2222
"keywords": [
2323
"build",
@@ -29,7 +29,7 @@
2929
"package-management"
3030
],
3131
"bugs": {
32-
"url": "https://github.com/hyperweb-io/makage/issues"
32+
"url": "https://github.com/constructive-io/makage/issues"
3333
},
3434
"dependencies": {
3535
"glob": "^11.0.0",

0 commit comments

Comments
 (0)