@rafi-ai/cli 0.1.0 → 0.2.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/README.md +14 -11
- package/dist/index.js +13 -1
- package/dist/project.d.ts +2 -2
- package/dist/project.js +3 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -12,33 +12,36 @@ npm install -g @rafi-ai/cli
|
|
|
12
12
|
|
|
13
13
|
## Use
|
|
14
14
|
|
|
15
|
+
Run `rafi` from inside the target repo:
|
|
16
|
+
|
|
15
17
|
```sh
|
|
16
|
-
|
|
17
|
-
rafi create
|
|
18
|
-
rafi
|
|
18
|
+
cd my-repo
|
|
19
|
+
rafi create . # interactive walkthrough
|
|
20
|
+
rafi create . --defaults # skip walkthrough, use built-in defaults
|
|
21
|
+
rafi compile . # re-render after editing project.yaml
|
|
19
22
|
```
|
|
20
23
|
|
|
21
24
|
## Commands
|
|
22
25
|
|
|
23
|
-
### `rafi create
|
|
26
|
+
### `rafi create .`
|
|
24
27
|
|
|
25
28
|
Runs the walkthrough (or `--defaults` to skip it), writes `project.yaml`, and compiles all configs.
|
|
26
29
|
|
|
27
30
|
```sh
|
|
28
|
-
rafi create
|
|
29
|
-
rafi create
|
|
30
|
-
rafi create
|
|
31
|
+
rafi create .
|
|
32
|
+
rafi create . --defaults # built-in defaults; byte-equivalent to the bundled rule set
|
|
33
|
+
rafi create . --force # overwrite existing doc files
|
|
31
34
|
```
|
|
32
35
|
|
|
33
|
-
The walkthrough collects your stack (frontend, backend, database, cloud, package manager) and three boolean flags: `usesAI`, `hasFrontend`, `runsInCloud`.
|
|
36
|
+
The walkthrough collects your stack (frontend, backend, database, cloud, package manager) and three boolean flags: `usesAI`, `hasFrontend`, `runsInCloud`. It also asks whether you'll use Claude Code — if yes, the Claude Agent SDK is installed automatically. Answers are saved to `project.yaml`.
|
|
34
37
|
|
|
35
|
-
### `rafi compile
|
|
38
|
+
### `rafi compile .`
|
|
36
39
|
|
|
37
40
|
Re-renders all configs from an existing `project.yaml`. Run this after editing the config or upgrading `special-agents`.
|
|
38
41
|
|
|
39
42
|
```sh
|
|
40
|
-
rafi compile
|
|
41
|
-
rafi compile
|
|
43
|
+
rafi compile .
|
|
44
|
+
rafi compile . --force
|
|
42
45
|
```
|
|
43
46
|
|
|
44
47
|
## What gets written
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Command } from "commander";
|
|
|
3
3
|
import { resolve, join } from "node:path";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
|
+
import { execSync } from "node:child_process";
|
|
6
7
|
import { parse as parseYaml } from "yaml";
|
|
7
8
|
import { assertProjectConfig } from "rafi-spec";
|
|
8
9
|
import { compile, writeProjectYaml } from "./compiler.js";
|
|
@@ -73,6 +74,9 @@ program
|
|
|
73
74
|
const usesAI = await confirm({ message: "Will this app call LLMs / do AI generation?", initialValue: false });
|
|
74
75
|
if (isCancel(usesAI))
|
|
75
76
|
process.exit(0);
|
|
77
|
+
const useClaude = await confirm({ message: "Will you use Claude Code as your agent runtime? (No = Codex only, skips the Claude Agent SDK)", initialValue: true });
|
|
78
|
+
if (isCancel(useClaude))
|
|
79
|
+
process.exit(0);
|
|
76
80
|
answers = {
|
|
77
81
|
appName: String(appName),
|
|
78
82
|
timezone: String(timezone),
|
|
@@ -82,7 +86,7 @@ program
|
|
|
82
86
|
cloud: String(cloudRaw),
|
|
83
87
|
packageManager: String(packageManager),
|
|
84
88
|
usesAI: Boolean(usesAI),
|
|
85
|
-
|
|
89
|
+
useClaude: Boolean(useClaude),
|
|
86
90
|
qa: true,
|
|
87
91
|
};
|
|
88
92
|
outro("Configuration collected — compiling...");
|
|
@@ -93,6 +97,14 @@ program
|
|
|
93
97
|
const aiStatus = config.flags.usesAI ? "on" : "off";
|
|
94
98
|
console.log(`rafi: compiled ${targetDir}`);
|
|
95
99
|
console.log(`rafi: AI rules: ${aiStatus === "off" ? "excluded — re-run \`rafi compile\` after setting usesAI: true to add them" : "included"}`);
|
|
100
|
+
if (answers.useClaude) {
|
|
101
|
+
console.log("rafi: installing Claude Agent SDK...");
|
|
102
|
+
execSync("npm install @anthropic-ai/claude-agent-sdk", { cwd: targetDir, stdio: "inherit" });
|
|
103
|
+
console.log("rafi: Claude Agent SDK installed.");
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
console.log("rafi: skipping Claude Agent SDK (Codex only).");
|
|
107
|
+
}
|
|
96
108
|
});
|
|
97
109
|
program.parseAsync(process.argv).catch((err) => {
|
|
98
110
|
console.error(`rafi: ${err instanceof Error ? err.message : String(err)}`);
|
package/dist/project.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ProjectConfig
|
|
1
|
+
import type { ProjectConfig } from "rafi-spec";
|
|
2
2
|
export declare const NO_UI = "No UI";
|
|
3
3
|
export declare const LOCAL_ONLY = "Local only";
|
|
4
4
|
export interface WalkthroughAnswers {
|
|
@@ -10,7 +10,7 @@ export interface WalkthroughAnswers {
|
|
|
10
10
|
cloud: string;
|
|
11
11
|
packageManager: string;
|
|
12
12
|
usesAI: boolean;
|
|
13
|
-
|
|
13
|
+
useClaude: boolean;
|
|
14
14
|
qa: boolean;
|
|
15
15
|
}
|
|
16
16
|
/** Default answers — equivalent to running with `--defaults`. */
|
package/dist/project.js
CHANGED
|
@@ -13,7 +13,7 @@ export function defaultAnswers() {
|
|
|
13
13
|
cloud: d.stack.cloud,
|
|
14
14
|
packageManager: d.stack.packageManager,
|
|
15
15
|
usesAI: Boolean(d.flags.usesAI),
|
|
16
|
-
|
|
16
|
+
useClaude: true,
|
|
17
17
|
qa: true,
|
|
18
18
|
};
|
|
19
19
|
}
|
|
@@ -21,6 +21,7 @@ export function defaultAnswers() {
|
|
|
21
21
|
export function buildProjectConfig(answers) {
|
|
22
22
|
const hasFrontend = answers.frontend !== NO_UI;
|
|
23
23
|
const runsInCloud = answers.cloud !== LOCAL_ONLY;
|
|
24
|
+
const targets = answers.useClaude ? ["claude", "codex"] : ["codex"];
|
|
24
25
|
return {
|
|
25
26
|
appName: answers.appName,
|
|
26
27
|
timezone: answers.timezone,
|
|
@@ -37,7 +38,7 @@ export function buildProjectConfig(answers) {
|
|
|
37
38
|
runsInCloud,
|
|
38
39
|
},
|
|
39
40
|
harness: {
|
|
40
|
-
targets
|
|
41
|
+
targets,
|
|
41
42
|
qa: answers.qa,
|
|
42
43
|
},
|
|
43
44
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rafi-ai/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Rafi CLI — scaffold and compile AI framework configs for a target repo.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@clack/prompts": "^1.4.0",
|
|
27
27
|
"commander": "^12.1.0",
|
|
28
28
|
"yaml": "^2.5.1",
|
|
29
|
-
"special-agents": "0.
|
|
29
|
+
"special-agents": "0.2.0",
|
|
30
30
|
"rafi-spec": "0.0.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|