role-os 1.8.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,140 +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
-
16
- const __dirname = dirname(fileURLToPath(import.meta.url));
17
- const VERSION = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8")).version;
18
-
19
- function printHelp() {
20
- console.log(`
21
- roleos v${VERSION} Role OS bootstrap CLI
22
-
23
- Usage:
24
- roleos init Scaffold Role OS into .claude/
25
- roleos init --force Update canonical files (protects context/)
26
- roleos packet new <type> Create a new packet (feature|integration|identity)
27
- roleos route <packet-file> [--verbose] Recommend the smallest valid chain
28
- roleos review <packet-file> <verdict> Record a review verdict
29
- roleos status Show active work, verdicts, and health
30
- roleos status --write Write .claude/status/index.md
31
- roleos status --json Output as JSON
32
- roleos packs list List all available team packs
33
- roleos packs suggest <packet-file> Suggest a pack for a packet
34
- roleos packs show <pack-key> Show full detail for a named pack
35
- roleos artifacts List all role artifact contracts
36
- roleos artifacts show <role> Show artifact contract for a role
37
- roleos artifacts validate <role> <file> Validate a file against a contract
38
- roleos artifacts chain <pack> Show pack handoff flow
39
- roleos mission list List all missions
40
- roleos mission show <key> Show full mission detail
41
- roleos mission suggest <text> Suggest a mission for a task
42
- roleos mission validate [key] Validate mission wiring
43
- roleos doctor Verify repo is wired for Role OS sessions
44
- roleos help Show this help
45
-
46
- Verdicts: accept | accept-with-notes | reject | blocked
47
- `);
48
- }
49
-
50
- /**
51
- * Structured error output. Matches shipcheck error shape:
52
- * code, message, hint, cause?, retryable?
53
- */
54
- function handleError(err) {
55
- const isUserError = err.exitCode === 1;
56
- const code = isUserError ? "USER_ERROR" : "RUNTIME_ERROR";
57
- const exitCode = isUserError ? 1 : 2;
58
-
59
- if (process.argv.includes("--debug")) {
60
- console.error(err.stack || err);
61
- } else {
62
- console.error(JSON.stringify({
63
- code,
64
- message: err.message,
65
- hint: err.hint || null,
66
- retryable: false,
67
- }));
68
- }
69
-
70
- process.exit(exitCode);
71
- }
72
-
73
- const command = process.argv[2] || "help";
74
- const args = process.argv.slice(3);
75
-
76
- try {
77
- switch (command) {
78
- case "init":
79
- if (args[0] === "claude") {
80
- const force = args.includes("--force");
81
- const result = scaffoldClaude(process.cwd(), { force });
82
- if (result.created.length > 0) {
83
- console.log(`Created:`);
84
- result.created.forEach(f => console.log(` + ${f}`));
85
- }
86
- if (result.skipped.length > 0) {
87
- console.log(`Skipped:`);
88
- result.skipped.forEach(f => console.log(` ~ ${f}`));
89
- }
90
- console.log(`\nDone. Claude Code will now use Role OS for routing.\nRun: roleos doctor to verify.`);
91
- } else {
92
- await initCommand(args);
93
- }
94
- break;
95
- case "doctor": {
96
- const result = doctor(process.cwd());
97
- console.log(formatDoctor(result));
98
- if (!result.healthy) process.exit(1);
99
- break;
100
- }
101
- case "packet":
102
- await packetCommand(args);
103
- break;
104
- case "route":
105
- await routeCommand(args);
106
- break;
107
- case "review":
108
- await reviewCommand(args);
109
- break;
110
- case "status":
111
- await statusCommand(args);
112
- break;
113
- case "packs":
114
- await packsCommand(args);
115
- break;
116
- case "artifacts":
117
- await artifactsCommand(args);
118
- break;
119
- case "mission":
120
- await missionCommand(args);
121
- break;
122
- case "help":
123
- case "--help":
124
- case "-h":
125
- printHelp();
126
- break;
127
- case "--version":
128
- case "-v":
129
- console.log(`roleos v${VERSION}`);
130
- break;
131
- default: {
132
- const err = new Error(`Unknown command: ${command}`);
133
- err.exitCode = 1;
134
- err.hint = "Run 'roleos help' for usage.";
135
- throw err;
136
- }
137
- }
138
- } catch (err) {
139
- handleError(err);
140
- }
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.8.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
+ }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Entry CLI — Phase T (v1.9.0)
3
+ *
4
+ * roleos start <task description> Decide best entry path automatically
5
+ * roleos start --json <text> Output as JSON
6
+ */
7
+
8
+ import { decideEntry, formatEntryDecision } from "./entry.mjs";
9
+
10
+ /**
11
+ * @param {string[]} args
12
+ */
13
+ export async function startCommand(args) {
14
+ const isJson = args.includes("--json");
15
+ const textArgs = args.filter(a => a !== "--json");
16
+ const text = textArgs.join(" ").trim();
17
+
18
+ if (!text) {
19
+ const err = new Error(
20
+ "Usage: roleos start <task description>\n" +
21
+ " Decides whether to route through a mission, pack, or free routing.\n\n" +
22
+ "Examples:\n" +
23
+ ' roleos start "fix the crash in save handler"\n' +
24
+ ' roleos start "add a new export command"\n' +
25
+ ' roleos start "run the full treatment before publishing"'
26
+ );
27
+ err.exitCode = 1;
28
+ err.hint = "Describe the task you want to accomplish.";
29
+ throw err;
30
+ }
31
+
32
+ const decision = decideEntry(text);
33
+
34
+ if (isJson) {
35
+ console.log(JSON.stringify(decision, null, 2));
36
+ } else {
37
+ console.log("");
38
+ console.log(formatEntryDecision(decision));
39
+ console.log("");
40
+
41
+ // Action guidance
42
+ if (decision.level === "mission") {
43
+ console.log("Next steps:");
44
+ console.log(` 1. roleos mission show ${decision.mission.key} # review the mission`);
45
+ console.log(` 2. Create a packet and start working through the mission steps`);
46
+ console.log(` 3. Use the mission runner to track progress and artifacts`);
47
+ } else if (decision.level === "pack") {
48
+ console.log("Next steps:");
49
+ console.log(` 1. roleos packs show ${decision.pack.key} # review the pack`);
50
+ console.log(` 2. roleos packet new feature # create a packet`);
51
+ console.log(` 3. roleos route <packet> --pack=${decision.pack.key} # route with pack`);
52
+ } else {
53
+ console.log("Next steps:");
54
+ console.log(" 1. roleos packet new feature # create a packet");
55
+ console.log(" 2. roleos route <packet> # free routing");
56
+ }
57
+ console.log("");
58
+ }
59
+ }