@refactco/refact-os 1.5.0 → 1.5.2
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/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
Notable changes to the refact-os standard and scaffolder.
|
|
4
4
|
|
|
5
|
-
**Staying current:** a consumer repo updates with `npm run refact:update` (or `npx
|
|
5
|
+
**Staying current:** a consumer repo updates with `npm run refact:update` (or `npx @refactco/refact-os init`). That refreshes the package-managed `agent/` payload, **prunes** skills this package has removed or renamed (safe — only skills the package previously shipped, never your own), regenerates `.cursor/` + `.claude/`, and flags `agent/AGENTS.md` drift for a manual merge. The version it last applied is recorded in `.refact-os.json` under `_scaffold.version`, and `init` prints the `old → new` transition so you can scan the entries below for anything needing manual action. Run `npm run refact:validate` afterward.
|
|
6
|
+
|
|
7
|
+
## 1.5.2
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- **npm auto-publish on tags.** A GitHub Actions workflow (`.github/workflows/publish.yml`) publishes to npm (with provenance) when a `vX.Y.Z` tag is pushed, after checking the tag matches `package.json`. Requires the repo secret `NPM_TOKEN` (an npm "Automation" token for the `refactco` org). Release flow: bump `package.json` + `CHANGELOG` → commit → `git tag vX.Y.Z` → `git push origin vX.Y.Z`.
|
|
11
|
+
- **Restored the `--adopt` flag** (it was lost before reaching `main`). `refact-os init --adopt` forces gentle / agent-layer-only mode on any repo — to re-adopt one an older `init` over-scaffolded, or update an existing repo without re-imposing the `docs/` seed, `apps/`, or WordPress dirs. It's the opposite of `--seed` (force full scaffold); `--adopt` wins if both are passed.
|
|
12
|
+
|
|
13
|
+
## 1.5.1
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- **Consumers now install from npm.** Scaffolded repos get `@refactco/refact-os` (`^1.5.0`) as their devDependency instead of the `github:refactco/refact-os` specifier. A repo scaffolded before the publish has its legacy GitHub devDependency **migrated** to the npm package on the next `init`/update (so it doesn't end up with two packages providing the same `refact-os` bin). README, the `adopt` / `update-package` skills, and the bootstrap commands now use `npx @refactco/refact-os …`.
|
|
6
17
|
|
|
7
18
|
## 1.5.0
|
|
8
19
|
|
package/README.md
CHANGED
|
@@ -8,27 +8,27 @@ You only ever edit one canonical folder, `agent/`. The tool generates the tool-s
|
|
|
8
8
|
|
|
9
9
|
## Get started
|
|
10
10
|
|
|
11
|
-
> refact-os is
|
|
11
|
+
> refact-os is published on npm as **`@refactco/refact-os`** (scoped, public).
|
|
12
12
|
|
|
13
13
|
Create a project and scaffold it:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
mkdir my-project && cd my-project
|
|
17
|
-
npx
|
|
17
|
+
npx @refactco/refact-os init
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
Choose the project type up front (skips the prompt):
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
npx
|
|
24
|
-
npx
|
|
23
|
+
npx @refactco/refact-os init --type nextjs # or: wordpress, blank
|
|
24
|
+
npx @refactco/refact-os init --type wordpress,nextjs # hybrid: apply both overlays
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
`init` adapts to the repo. An **empty** repo gets the full scaffold (substrate seed + skills + overlays). An **existing** repo gets **only the agent layer** (skills, including `adopt`) so it never imposes folders over your structure — then `/adopt` plans the transition. Force the full scaffold on a non-empty repo with `--seed`. See the **Bringing an existing repo** note under [Commands](#commands) below.
|
|
28
28
|
|
|
29
29
|
## Run it inside your project (npm)
|
|
30
30
|
|
|
31
|
-
After `init`, your `package.json` gets a
|
|
31
|
+
After `init`, your `package.json` gets a `@refactco/refact-os` dev-dependency and ready-made scripts. From then on you use plain **npm** — no more typing the full `npx @refactco/refact-os …`:
|
|
32
32
|
|
|
33
33
|
```jsonc
|
|
34
34
|
"scripts": {
|
|
@@ -80,13 +80,13 @@ refact-os validate [--target <dir>] # check structure + ski
|
|
|
80
80
|
refact-os migrate [--target <dir>] # move an older layout into the current one
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
-
- **`init`** — scaffold a project. An **empty** repo gets the thin seed + base `agent/` skills + type overlays + adapters; an **existing** repo gets only the agent layer (then run `/adopt`). `--seed` forces the full scaffold on a non-empty repo; `--no-force` never overwrites existing files.
|
|
83
|
+
- **`init`** — scaffold a project. An **empty** repo gets the thin seed + base `agent/` skills + type overlays + adapters; an **existing** repo gets only the agent layer (then run `/adopt`). `--seed` forces the full scaffold on a non-empty repo; `--adopt` forces agent-layer-only on any repo (re-adopt one an older `init` over-scaffolded, or update an existing repo without imposing structure); `--no-force` never overwrites existing files.
|
|
84
84
|
- **`sync`** — after editing `agent/`, regenerate `.cursor/` and `.claude/`. Never edit those by hand.
|
|
85
85
|
- **`validate`** — checks the required folders/files exist, every skill declares its resolver frontmatter (the fields the agent routes on — `name`, `pattern`, `description`, `when_to_use`, `when_not_to_use`, `next_skills`), the generated skill index isn't stale, and the adapters are in sync.
|
|
86
86
|
- **`migrate`** — moves an old-layout repo into the current one and tops up the `package.json` scripts. Safe: it never overwrites an existing file, and merges old chat folders into the new location.
|
|
87
87
|
- **`sync company`** — pulls Refact's shared company context (brand, team, pitch) from `refactco/refact-operation` into `docs/context/company/`. Re-syncable, so it never drifts permanently. Source + SHA are recorded in `.refact-os.json`.
|
|
88
88
|
|
|
89
|
-
**Bringing an existing repo to the standard:** just run `npx
|
|
89
|
+
**Bringing an existing repo to the standard:** just run `npx @refactco/refact-os init`. It detects that the repo isn't empty and adds **only the agent layer** — the skills (including `adopt`), root pointers, config, and adapters — *without* dropping a `docs/` seed or `apps/` over your existing structure, and without applying type overlays. Then run the **`adopt`** skill (`/adopt`): it surveys the repo, writes a phased transition plan to `docs/task/open/`, and reconciles your structure with the standard — asking before anything ambiguous — until `refact-os validate` is green. (Pass `--seed` if you actually want the full greenfield scaffold on a non-empty repo.)
|
|
90
90
|
|
|
91
91
|
## What gets generated
|
|
92
92
|
|
package/bin/refact-os.js
CHANGED
|
@@ -26,7 +26,7 @@ function isAllowedTarget(target) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
function parseArgs(argv) {
|
|
29
|
-
const args = { command: "init", sub: undefined, target: process.cwd(), projectType: undefined, overlays: [], force: true, seed: false };
|
|
29
|
+
const args = { command: "init", sub: undefined, target: process.cwd(), projectType: undefined, overlays: [], force: true, seed: false, adopt: false };
|
|
30
30
|
const raw = [...argv];
|
|
31
31
|
if (raw[0] && !raw[0].startsWith("-")) args.command = raw.shift();
|
|
32
32
|
if (raw[0] && !raw[0].startsWith("-")) args.sub = raw.shift();
|
|
@@ -37,6 +37,7 @@ function parseArgs(argv) {
|
|
|
37
37
|
else if (token === "--target") args.target = raw.shift();
|
|
38
38
|
else if (token === "--no-force") args.force = false;
|
|
39
39
|
else if (token === "--seed") args.seed = true;
|
|
40
|
+
else if (token === "--adopt") args.adopt = true;
|
|
40
41
|
}
|
|
41
42
|
return args;
|
|
42
43
|
}
|
|
@@ -47,6 +48,7 @@ async function runScaffold(args, { force }) {
|
|
|
47
48
|
overlays: args.overlays,
|
|
48
49
|
force,
|
|
49
50
|
seed: args.seed,
|
|
51
|
+
adopt: args.adopt,
|
|
50
52
|
interactive: process.stdin.isTTY,
|
|
51
53
|
});
|
|
52
54
|
console.log(`Scaffolded ${result.filesWritten} files in ${result.target}`);
|
package/lib/project-utils.js
CHANGED
|
@@ -104,20 +104,27 @@ const SCAFFOLD_SCRIPTS = {
|
|
|
104
104
|
"refact:update": "refact-os init",
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
-
// refact-os is
|
|
108
|
-
// devDependency is what lets the `refact:*` npm scripts above call the
|
|
109
|
-
// `refact-os` binary (instead of fetching it via npx
|
|
107
|
+
// refact-os is published to npm as @refactco/refact-os. Adding it as a
|
|
108
|
+
// devDependency is what lets the `refact:*` npm scripts above call the
|
|
109
|
+
// `refact-os` binary (which the package provides) instead of fetching it via npx.
|
|
110
110
|
const SCAFFOLD_DEV_DEPENDENCIES = {
|
|
111
|
-
"refact-os": "
|
|
111
|
+
"@refactco/refact-os": "^1.5.0",
|
|
112
112
|
};
|
|
113
113
|
|
|
114
114
|
// Add scaffold devDependencies that aren't already declared (in either
|
|
115
115
|
// dependencies or devDependencies). Non-destructive; mutates `data` and
|
|
116
|
-
// returns the names added.
|
|
116
|
+
// returns the names added. Also migrates the legacy GitHub-specifier
|
|
117
|
+
// devDependency (`refact-os: github:refactco/refact-os`) to the npm package, so
|
|
118
|
+
// a repo scaffolded before the npm publish doesn't end up with both (two
|
|
119
|
+
// packages providing the same `refact-os` bin).
|
|
117
120
|
function _ensureDevDependencies(data) {
|
|
118
121
|
const depsAdded = [];
|
|
119
122
|
const deps = data.dependencies || {};
|
|
120
123
|
const devDeps = data.devDependencies || {};
|
|
124
|
+
if (typeof devDeps["refact-os"] === "string" && /github:refactco\/refact-os/i.test(devDeps["refact-os"])) {
|
|
125
|
+
delete devDeps["refact-os"];
|
|
126
|
+
data.devDependencies = devDeps;
|
|
127
|
+
}
|
|
121
128
|
for (const [name, spec] of Object.entries(SCAFFOLD_DEV_DEPENDENCIES)) {
|
|
122
129
|
if (name in deps || name in devDeps) continue;
|
|
123
130
|
devDeps[name] = spec;
|
package/lib/scaffold.js
CHANGED
|
@@ -216,13 +216,17 @@ async function scaffoldProject(targetDir, options = {}) {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
// Brownfield vs greenfield. Decided once (at first init) and recorded, so a
|
|
219
|
-
// later `init`/update never suddenly imposes structure on an adopted repo.
|
|
220
|
-
//
|
|
221
|
-
//
|
|
222
|
-
//
|
|
223
|
-
//
|
|
219
|
+
// later `init`/update never suddenly imposes structure on an adopted repo. On a
|
|
220
|
+
// brownfield repo we add ONLY the agent layer (base skills, root pointers,
|
|
221
|
+
// config, adapters) and defer the docs/ seed, apps/, and type overlays to the
|
|
222
|
+
// `adopt` skill. The two flags are opposites and override detection/recorded
|
|
223
|
+
// state: `--adopt` (options.adopt) forces gentle mode (re-adopt a repo an older
|
|
224
|
+
// init over-scaffolded, or update an existing one without imposing structure);
|
|
225
|
+
// `--seed` (options.seed) forces the full scaffold. `--adopt` wins if both pass.
|
|
224
226
|
let brownfield;
|
|
225
|
-
if (options.
|
|
227
|
+
if (options.adopt) {
|
|
228
|
+
brownfield = true;
|
|
229
|
+
} else if (options.seed) {
|
|
226
230
|
brownfield = false;
|
|
227
231
|
} else if (!hadConfig) {
|
|
228
232
|
brownfield = repoHasOwnContent(resolvedTarget);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@refactco/refact-os",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Installable scaffolder for the agent-first repo standard: minimum-seed substrate + canonical agent/ skill catalog with generated tool adapters",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -3,8 +3,8 @@ name: adopt
|
|
|
3
3
|
pattern: procedure
|
|
4
4
|
requires_approval: false
|
|
5
5
|
description: Produce a PLAN for bringing an existing, non-conformant repo up to the agent-first standard. Surveys the repo and outputs a phased transition plan as its final response — it does NOT change anything.
|
|
6
|
-
when_to_use: The user wants to understand what it would take to bring an existing repo to the standard — "adopt this repo", "make this repo agent-first", "what's the plan to conform this repo", "plan the migration". Run after `npx
|
|
7
|
-
when_not_to_use: For a brand-new empty project (use `npx
|
|
6
|
+
when_to_use: The user wants to understand what it would take to bring an existing repo to the standard — "adopt this repo", "make this repo agent-first", "what's the plan to conform this repo", "plan the migration". Run after `npx @refactco/refact-os init --no-force` has laid the mechanical seed.
|
|
7
|
+
when_not_to_use: For a brand-new empty project (use `npx @refactco/refact-os init`). When the user explicitly asks you to EXECUTE a plan that already exists (this skill only plans — execution is a separate, explicit step the user approves).
|
|
8
8
|
inputs:
|
|
9
9
|
- the target repository (surveyed read-only, not fully read)
|
|
10
10
|
- the standard at docs/agent-first-repo-best-practices.md (or the refact-os package copy)
|
|
@@ -29,9 +29,9 @@ Produce a **plan** for bringing an existing repo to the agent-first standard. Th
|
|
|
29
29
|
## Steps
|
|
30
30
|
|
|
31
31
|
1. **Survey** the repo breadth-first (sub-agents per area). For each area note: what's there, which of the six roles it maps to (Evidence/Knowledge/Task/Output/Software/Agent), and anything load-bearing (scripts, automation, hardcoded paths).
|
|
32
|
-
2. **Read the gaps:** run `npm run refact:validate` (read-only) and fold its findings in. If the script/binary isn't wired up yet, fall back to `npx
|
|
32
|
+
2. **Read the gaps:** run `npm run refact:validate` (read-only) and fold its findings in. If the script/binary isn't wired up yet, fall back to `npx @refactco/refact-os validate` (read-only, touches nothing in the repo) — don't run `npm install` here, since this skill changes nothing.
|
|
33
33
|
3. **Write the plan** and present it as your final response. Structure it as ordered **phases**, each a small reviewable unit, with: the proposed moves/renames/**deletions**, the references that would need updating, and any open questions. Typical items:
|
|
34
|
-
- Missing seed → `npx
|
|
34
|
+
- Missing seed → `npx @refactco/refact-os init --no-force` (additive).
|
|
35
35
|
- Duplicate canonical map (`INDEX.md` vs `docs/index.md`) → which is canonical; merge the other.
|
|
36
36
|
- Duplicate contract (root `AGENTS.md` vs `agent/AGENTS.md`) → consolidate into `agent/AGENTS.md`, leave a thin root pointer.
|
|
37
37
|
- Variant dirs (`docs/tasks` vs `docs/task`) → consolidate onto the standard name.
|
|
@@ -14,27 +14,27 @@ Use this when the user asks to update / bump / refresh / reinstall `refact-os` i
|
|
|
14
14
|
|
|
15
15
|
## Source
|
|
16
16
|
|
|
17
|
-
`refact-os`
|
|
17
|
+
`refact-os` is published to npm as **`@refactco/refact-os`** (scoped public). Install it from npm unless the user explicitly names a local checkout (e.g. `../refact-os` for development). The binary it provides is still `refact-os`, so the `refact:*` npm scripts are unchanged.
|
|
18
18
|
|
|
19
19
|
## Workflow
|
|
20
20
|
|
|
21
21
|
1. **Detect the package manager** from lockfiles: `pnpm-lock.yaml` → pnpm; `yarn.lock` → yarn; `package-lock.json` or none → npm.
|
|
22
22
|
2. **Bump the package** (show the command first; let the user override the source):
|
|
23
|
-
- npm: `npm install
|
|
24
|
-
- pnpm: `pnpm add
|
|
25
|
-
- yarn: `yarn add
|
|
23
|
+
- npm: `npm install -D @refactco/refact-os@latest`
|
|
24
|
+
- pnpm: `pnpm add -D @refactco/refact-os@latest`
|
|
25
|
+
- yarn: `yarn add -D @refactco/refact-os@latest`
|
|
26
26
|
|
|
27
|
-
Installing
|
|
27
|
+
Installing does **not** scaffold anything (there is no postinstall), so apply the refresh explicitly in the next step.
|
|
28
28
|
3. **Refresh the payload:** `npx refact-os init` (or `npm run refact:update`). It is idempotent and:
|
|
29
29
|
- force-copies package-managed files (the `agent/` skills, hooks, scripts, root pointers); your own files are preserved (`agent/AGENTS.md`, `README.md`, everything under `docs/`).
|
|
30
30
|
- **prunes** skills the package removed or renamed since your last update (tracked via `_scaffold.shippedSkills` in `.refact-os.json`); skills you authored are never pruned.
|
|
31
31
|
- regenerates `.cursor/` and `.claude/` from `agent/`.
|
|
32
32
|
- prints the version transition (`old → new`) and any pruned skills.
|
|
33
33
|
4. **Read the output** and surface to the user:
|
|
34
|
-
- the version transition — point them at `node_modules/refact-os/CHANGELOG.md` for what changed and whether anything needs manual action.
|
|
34
|
+
- the version transition — point them at `node_modules/@refactco/refact-os/CHANGELOG.md` for what changed and whether anything needs manual action.
|
|
35
35
|
- any pruned skills.
|
|
36
36
|
- the **`agent/AGENTS.md` drift warning** if it fired (the upstream contract template changed; your copy is never overwritten).
|
|
37
|
-
5. **agent/AGENTS.md drift follow-up** (only if the warning fired): read the installed template at `node_modules/refact-os/templates/base/agent/AGENTS.md` and the project's `agent/AGENTS.md`, diff them, and surface the meaningful additions as *suggestions*. Wait for the user's go-ahead before editing; preserve project-specific values (stack, hosting, URLs, SSH) — never replace them with template placeholders.
|
|
37
|
+
5. **agent/AGENTS.md drift follow-up** (only if the warning fired): read the installed template at `node_modules/@refactco/refact-os/templates/base/agent/AGENTS.md` and the project's `agent/AGENTS.md`, diff them, and surface the meaningful additions as *suggestions*. Wait for the user's go-ahead before editing; preserve project-specific values (stack, hosting, URLs, SSH) — never replace them with template placeholders.
|
|
38
38
|
6. **Validate:** run `npm run refact:validate` and report the result. If it surfaces structural gaps (common when the standard adds folders/roles), suggest `/adopt` to reconcile them.
|
|
39
39
|
7. **Report:** source used, installed version/SHA, version transition, files changed, pruned skills, whether the AGENTS.md drift fired, and follow-up steps (review the diff, run tests, commit).
|
|
40
40
|
|
|
@@ -45,7 +45,7 @@ If the user explicitly wants to install from a local clone (developing refact-os
|
|
|
45
45
|
## Guardrails
|
|
46
46
|
|
|
47
47
|
- Prefer package-manager commands over hand-editing `package.json`.
|
|
48
|
-
-
|
|
48
|
+
- Prefer the published npm package (`@refactco/refact-os`); a local checkout (`../refact-os`) is opt-in for development only.
|
|
49
49
|
- Never run destructive git commands.
|
|
50
50
|
- If install fails, capture the exact error and suggest the smallest fix — don't silently retry with a different source.
|
|
51
51
|
- The refresh prunes only skills the package previously shipped. If the user customized a package skill in place (discouraged — fork it with a project prefix instead), warn them it will be overwritten or pruned.
|