role-os 1.9.0 → 2.0.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.
package/bin/roleos.mjs CHANGED
@@ -1,145 +1,205 @@
1
- #!/usr/bin/env node
2
-
3
- import { readFileSync } from "node:fs";
4
- import { join, dirname } from "node:path";
5
- import { fileURLToPath } from "node:url";
6
- import { initCommand } from "../src/init.mjs";
7
- import { packetCommand } from "../src/packet.mjs";
8
- import { routeCommand } from "../src/route.mjs";
9
- import { reviewCommand } from "../src/review.mjs";
10
- import { statusCommand } from "../src/status.mjs";
11
- import { packsCommand } from "../src/packs-cmd.mjs";
12
- import { scaffoldClaude, doctor, formatDoctor } from "../src/session.mjs";
13
- import { artifactsCommand } from "../src/artifacts-cmd.mjs";
14
- import { missionCommand } from "../src/mission-cmd.mjs";
15
- import { startCommand } from "../src/entry-cmd.mjs";
16
-
17
- const __dirname = dirname(fileURLToPath(import.meta.url));
18
- const VERSION = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8")).version;
19
-
20
- function printHelp() {
21
- console.log(`
22
- roleos v${VERSION} — Role OS bootstrap CLI
23
-
24
- Usage:
25
- roleos start <task> Decide entry path: mission, pack, or free routing
26
- roleos init Scaffold Role OS into .claude/
27
- roleos init --force Update canonical files (protects context/)
28
- roleos packet new <type> Create a new packet (feature|integration|identity)
29
- roleos route <packet-file> [--verbose] Recommend the smallest valid chain
30
- roleos review <packet-file> <verdict> Record a review verdict
31
- roleos status Show active work, verdicts, and health
32
- roleos status --write Write .claude/status/index.md
33
- roleos status --json Output as JSON
34
- roleos packs list List all available team packs
35
- roleos packs suggest <packet-file> Suggest a pack for a packet
36
- roleos packs show <pack-key> Show full detail for a named pack
37
- roleos artifacts List all role artifact contracts
38
- roleos artifacts show <role> Show artifact contract for a role
39
- roleos artifacts validate <role> <file> Validate a file against a contract
40
- roleos artifacts chain <pack> Show pack handoff flow
41
- roleos mission list List all missions
42
- roleos mission show <key> Show full mission detail
43
- roleos mission suggest <text> Suggest a mission for a task
44
- roleos mission validate [key] Validate mission wiring
45
- roleos doctor Verify repo is wired for Role OS sessions
46
- roleos help Show this help
47
-
48
- Verdicts: accept | accept-with-notes | reject | blocked
49
- `);
50
- }
51
-
52
- /**
53
- * Structured error output. Matches shipcheck error shape:
54
- * code, message, hint, cause?, retryable?
55
- */
56
- function handleError(err) {
57
- const isUserError = err.exitCode === 1;
58
- const code = isUserError ? "USER_ERROR" : "RUNTIME_ERROR";
59
- const exitCode = isUserError ? 1 : 2;
60
-
61
- if (process.argv.includes("--debug")) {
62
- console.error(err.stack || err);
63
- } else {
64
- console.error(JSON.stringify({
65
- code,
66
- message: err.message,
67
- hint: err.hint || null,
68
- retryable: false,
69
- }));
70
- }
71
-
72
- process.exit(exitCode);
73
- }
74
-
75
- const command = process.argv[2] || "help";
76
- const args = process.argv.slice(3);
77
-
78
- try {
79
- switch (command) {
80
- case "start":
81
- await startCommand(args);
82
- break;
83
- case "init":
84
- if (args[0] === "claude") {
85
- const force = args.includes("--force");
86
- const result = scaffoldClaude(process.cwd(), { force });
87
- if (result.created.length > 0) {
88
- console.log(`Created:`);
89
- result.created.forEach(f => console.log(` + ${f}`));
90
- }
91
- if (result.skipped.length > 0) {
92
- console.log(`Skipped:`);
93
- result.skipped.forEach(f => console.log(` ~ ${f}`));
94
- }
95
- console.log(`\nDone. Claude Code will now use Role OS for routing.\nRun: roleos doctor to verify.`);
96
- } else {
97
- await initCommand(args);
98
- }
99
- break;
100
- case "doctor": {
101
- const result = doctor(process.cwd());
102
- console.log(formatDoctor(result));
103
- if (!result.healthy) process.exit(1);
104
- break;
105
- }
106
- case "packet":
107
- await packetCommand(args);
108
- break;
109
- case "route":
110
- await routeCommand(args);
111
- break;
112
- case "review":
113
- await reviewCommand(args);
114
- break;
115
- case "status":
116
- await statusCommand(args);
117
- break;
118
- case "packs":
119
- await packsCommand(args);
120
- break;
121
- case "artifacts":
122
- await artifactsCommand(args);
123
- break;
124
- case "mission":
125
- await missionCommand(args);
126
- break;
127
- case "help":
128
- case "--help":
129
- case "-h":
130
- printHelp();
131
- break;
132
- case "--version":
133
- case "-v":
134
- console.log(`roleos v${VERSION}`);
135
- break;
136
- default: {
137
- const err = new Error(`Unknown command: ${command}`);
138
- err.exitCode = 1;
139
- err.hint = "Run 'roleos help' for usage.";
140
- throw err;
141
- }
142
- }
143
- } catch (err) {
144
- handleError(err);
145
- }
1
+ #!/usr/bin/env node
2
+
3
+ import { readFileSync } from "node:fs";
4
+ import { join, dirname } from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { initCommand } from "../src/init.mjs";
7
+ import { packetCommand } from "../src/packet.mjs";
8
+ import { routeCommand } from "../src/route.mjs";
9
+ import { reviewCommand } from "../src/review.mjs";
10
+ import { statusCommand } from "../src/status.mjs";
11
+ import { packsCommand } from "../src/packs-cmd.mjs";
12
+ import { scaffoldClaude, doctor, formatDoctor } from "../src/session.mjs";
13
+ import { artifactsCommand } from "../src/artifacts-cmd.mjs";
14
+ import { missionCommand } from "../src/mission-cmd.mjs";
15
+ import { startCommand } from "../src/entry-cmd.mjs";
16
+ import {
17
+ runCommand, resumeCommand, nextCommand, explainCommand,
18
+ completeCommand, failCommand, retryCommand, rerouteCommand,
19
+ escalateCommand, blockCommand, reopenCommand, reportCommand,
20
+ frictionCommand,
21
+ } from "../src/run-cmd.mjs";
22
+
23
+ const __dirname = dirname(fileURLToPath(import.meta.url));
24
+ const VERSION = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8")).version;
25
+
26
+ function printHelp() {
27
+ console.log(`
28
+ roleos v${VERSION} Role OS bootstrap CLI
29
+
30
+ Usage:
31
+ roleos start <task> Decide entry path: mission, pack, or free routing
32
+ roleos run "<task>" Create and start a persistent run
33
+ roleos run list List all runs
34
+ roleos run show <id> Show run detail
35
+ roleos resume [id] Resume an interrupted run
36
+ roleos next Start the next step (or show what's next)
37
+ roleos explain [id] Explain current run state
38
+ roleos complete <artifact> [note] Complete the active step
39
+ roleos fail <partial|failed> <reason> Fail the active step
40
+ roleos retry <step-index> Retry a failed step
41
+ roleos reroute <step> <role> <reason> Reroute a step to a different role
42
+ roleos escalate <from> <to> <trigger> <action> Escalate between roles
43
+ roleos block <step-index> <reason> Block a step
44
+ roleos reopen <step-index> <reason> Reopen a completed step
45
+ roleos report [id] Generate completion report
46
+ roleos friction [id] Measure operator friction
47
+ roleos init Scaffold Role OS into .claude/
48
+ roleos init --force Update canonical files (protects context/)
49
+ roleos packet new <type> Create a new packet (feature|integration|identity)
50
+ roleos route <packet-file> [--verbose] Recommend the smallest valid chain
51
+ roleos review <packet-file> <verdict> Record a review verdict
52
+ roleos status Show active work, verdicts, and health
53
+ roleos status --write Write .claude/status/index.md
54
+ roleos status --json Output as JSON
55
+ roleos packs list List all available team packs
56
+ roleos packs suggest <packet-file> Suggest a pack for a packet
57
+ roleos packs show <pack-key> Show full detail for a named pack
58
+ roleos artifacts List all role artifact contracts
59
+ roleos artifacts show <role> Show artifact contract for a role
60
+ roleos artifacts validate <role> <file> Validate a file against a contract
61
+ roleos artifacts chain <pack> Show pack handoff flow
62
+ roleos mission list List all missions
63
+ roleos mission show <key> Show full mission detail
64
+ roleos mission suggest <text> Suggest a mission for a task
65
+ roleos mission validate [key] Validate mission wiring
66
+ roleos doctor Verify repo is wired for Role OS sessions
67
+ roleos help Show this help
68
+
69
+ Verdicts: accept | accept-with-notes | reject | blocked
70
+ `);
71
+ }
72
+
73
+ /**
74
+ * Structured error output. Matches shipcheck error shape:
75
+ * code, message, hint, cause?, retryable?
76
+ */
77
+ function handleError(err) {
78
+ const isUserError = err.exitCode === 1;
79
+ const code = isUserError ? "USER_ERROR" : "RUNTIME_ERROR";
80
+ const exitCode = isUserError ? 1 : 2;
81
+
82
+ if (process.argv.includes("--debug")) {
83
+ console.error(err.stack || err);
84
+ } else {
85
+ console.error(JSON.stringify({
86
+ code,
87
+ message: err.message,
88
+ hint: err.hint || null,
89
+ retryable: false,
90
+ }));
91
+ }
92
+
93
+ process.exit(exitCode);
94
+ }
95
+
96
+ const command = process.argv[2] || "help";
97
+ const args = process.argv.slice(3);
98
+
99
+ try {
100
+ switch (command) {
101
+ case "start":
102
+ await startCommand(args);
103
+ break;
104
+ case "init":
105
+ if (args[0] === "claude") {
106
+ const force = args.includes("--force");
107
+ const result = scaffoldClaude(process.cwd(), { force });
108
+ if (result.created.length > 0) {
109
+ console.log(`Created:`);
110
+ result.created.forEach(f => console.log(` + ${f}`));
111
+ }
112
+ if (result.skipped.length > 0) {
113
+ console.log(`Skipped:`);
114
+ result.skipped.forEach(f => console.log(` ~ ${f}`));
115
+ }
116
+ console.log(`\nDone. Claude Code will now use Role OS for routing.\nRun: roleos doctor to verify.`);
117
+ } else {
118
+ await initCommand(args);
119
+ }
120
+ break;
121
+ case "doctor": {
122
+ const result = doctor(process.cwd());
123
+ console.log(formatDoctor(result));
124
+ if (!result.healthy) process.exit(1);
125
+ break;
126
+ }
127
+ case "packet":
128
+ await packetCommand(args);
129
+ break;
130
+ case "route":
131
+ await routeCommand(args);
132
+ break;
133
+ case "review":
134
+ await reviewCommand(args);
135
+ break;
136
+ case "status":
137
+ await statusCommand(args);
138
+ break;
139
+ case "packs":
140
+ await packsCommand(args);
141
+ break;
142
+ case "artifacts":
143
+ await artifactsCommand(args);
144
+ break;
145
+ case "run":
146
+ await runCommand(args);
147
+ break;
148
+ case "resume":
149
+ await resumeCommand(args);
150
+ break;
151
+ case "next":
152
+ await nextCommand(args);
153
+ break;
154
+ case "explain":
155
+ await explainCommand(args);
156
+ break;
157
+ case "complete":
158
+ await completeCommand(args);
159
+ break;
160
+ case "fail":
161
+ await failCommand(args);
162
+ break;
163
+ case "retry":
164
+ await retryCommand(args);
165
+ break;
166
+ case "reroute":
167
+ await rerouteCommand(args);
168
+ break;
169
+ case "escalate":
170
+ await escalateCommand(args);
171
+ break;
172
+ case "block":
173
+ await blockCommand(args);
174
+ break;
175
+ case "reopen":
176
+ await reopenCommand(args);
177
+ break;
178
+ case "report":
179
+ await reportCommand(args);
180
+ break;
181
+ case "friction":
182
+ await frictionCommand(args);
183
+ break;
184
+ case "mission":
185
+ await missionCommand(args);
186
+ break;
187
+ case "help":
188
+ case "--help":
189
+ case "-h":
190
+ printHelp();
191
+ break;
192
+ case "--version":
193
+ case "-v":
194
+ console.log(`roleos v${VERSION}`);
195
+ break;
196
+ default: {
197
+ const err = new Error(`Unknown command: ${command}`);
198
+ err.exitCode = 1;
199
+ err.hint = "Run 'roleos help' for usage.";
200
+ throw err;
201
+ }
202
+ }
203
+ } catch (err) {
204
+ handleError(err);
205
+ }
package/package.json CHANGED
@@ -1,51 +1,51 @@
1
- {
2
- "name": "role-os",
3
- "version": "1.9.0",
4
- "description": "Role OS — a multi-Claude operating system where 31 specialized roles execute work through contracts, conflict detection, escalation, and structured evidence. 7 proven team packs for common task families.",
5
- "homepage": "https://mcp-tool-shop-org.github.io/role-os/",
6
- "bugs": {
7
- "url": "https://github.com/mcp-tool-shop-org/role-os/issues"
8
- },
9
- "type": "module",
10
- "bin": {
11
- "roleos": "bin/roleos.mjs"
12
- },
13
- "files": [
14
- "bin",
15
- "src",
16
- "starter-pack",
17
- "README.md",
18
- "CHANGELOG.md",
19
- "LICENSE"
20
- ],
21
- "scripts": {
22
- "test": "node --test test/*.test.mjs",
23
- "verify": "node --test test/*.test.mjs && node bin/roleos.mjs help && echo '✓ verify passed'"
24
- },
25
- "engines": {
26
- "node": ">=18.0.0"
27
- },
28
- "author": "mcp-tool-shop <64996768+mcp-tool-shop@users.noreply.github.com>",
29
- "license": "MIT",
30
- "repository": {
31
- "type": "git",
32
- "url": "https://github.com/mcp-tool-shop-org/role-os.git"
33
- },
34
- "keywords": [
35
- "role-os",
36
- "agents",
37
- "contracts",
38
- "handoffs",
39
- "review",
40
- "workflow",
41
- "multi-agent",
42
- "ai-workflow",
43
- "developer-tools",
44
- "role-contracts",
45
- "claude",
46
- "multi-claude"
47
- ],
48
- "publishConfig": {
49
- "registry": "https://registry.npmjs.org"
50
- }
51
- }
1
+ {
2
+ "name": "role-os",
3
+ "version": "2.0.0",
4
+ "description": "Role OS — a multi-Claude operating system where 31 specialized roles execute work through contracts, conflict detection, escalation, and structured evidence. 7 proven team packs for common task families.",
5
+ "homepage": "https://mcp-tool-shop-org.github.io/role-os/",
6
+ "bugs": {
7
+ "url": "https://github.com/mcp-tool-shop-org/role-os/issues"
8
+ },
9
+ "type": "module",
10
+ "bin": {
11
+ "roleos": "bin/roleos.mjs"
12
+ },
13
+ "files": [
14
+ "bin",
15
+ "src",
16
+ "starter-pack",
17
+ "README.md",
18
+ "CHANGELOG.md",
19
+ "LICENSE"
20
+ ],
21
+ "scripts": {
22
+ "test": "node --test test/*.test.mjs",
23
+ "verify": "node --test test/*.test.mjs && node bin/roleos.mjs help && echo '✓ verify passed'"
24
+ },
25
+ "engines": {
26
+ "node": ">=18.0.0"
27
+ },
28
+ "author": "mcp-tool-shop <64996768+mcp-tool-shop@users.noreply.github.com>",
29
+ "license": "MIT",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/mcp-tool-shop-org/role-os.git"
33
+ },
34
+ "keywords": [
35
+ "role-os",
36
+ "agents",
37
+ "contracts",
38
+ "handoffs",
39
+ "review",
40
+ "workflow",
41
+ "multi-agent",
42
+ "ai-workflow",
43
+ "developer-tools",
44
+ "role-contracts",
45
+ "claude",
46
+ "multi-claude"
47
+ ],
48
+ "publishConfig": {
49
+ "registry": "https://registry.npmjs.org"
50
+ }
51
+ }