runshift 0.0.2 → 0.0.3
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/.claude/settings.local.json +11 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +129 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/context/collector.d.ts +4 -0
- package/dist/context/collector.d.ts.map +1 -0
- package/dist/context/collector.js +191 -0
- package/dist/context/collector.js.map +1 -0
- package/dist/context/git.d.ts +7 -0
- package/dist/context/git.d.ts.map +1 -0
- package/dist/context/git.js +30 -0
- package/dist/context/git.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/display.d.ts +14 -0
- package/dist/ui/display.d.ts.map +1 -0
- package/dist/ui/display.js +148 -0
- package/dist/ui/display.js.map +1 -0
- package/dist/ui/prompt.d.ts +4 -0
- package/dist/ui/prompt.d.ts.map +1 -0
- package/dist/ui/prompt.js +31 -0
- package/dist/ui/prompt.js.map +1 -0
- package/dist/writer.d.ts +4 -0
- package/dist/writer.d.ts.map +1 -0
- package/dist/writer.js +29 -0
- package/dist/writer.js.map +1 -0
- package/package.json +22 -4
- package/src/commands/init.ts +163 -0
- package/src/context/collector.ts +205 -0
- package/src/context/git.ts +36 -0
- package/src/index.ts +35 -0
- package/src/types.ts +44 -0
- package/src/ui/display.ts +164 -0
- package/src/ui/prompt.ts +33 -0
- package/src/writer.ts +37 -0
- package/tsconfig.json +19 -0
- package/index.js +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AA0BA,wBAAsB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAwI1C"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import ora from "ora";
|
|
2
|
+
import { collectRepoContext, addFileToContext } from "../context/collector.js";
|
|
3
|
+
import { getGitState } from "../context/git.js";
|
|
4
|
+
import { showBanner, showNotGitRepo, showDirtyWarning, showBranchInfo, showScanResults, showFindings, showFileList, showSummary, showSuccess, showError, } from "../ui/display.js";
|
|
5
|
+
import { confirm, promptChoice, promptFilePath } from "../ui/prompt.js";
|
|
6
|
+
import { writeFiles, commitFiles } from "../writer.js";
|
|
7
|
+
const API_URL = process.env.RUNSHIFT_DEV === "true"
|
|
8
|
+
? "http://localhost:3000/api/cli/init"
|
|
9
|
+
: "https://runshift.ai/api/cli/init";
|
|
10
|
+
const TIMEOUT_MS = 240_000;
|
|
11
|
+
export async function init() {
|
|
12
|
+
showBanner();
|
|
13
|
+
// ── 1. Git safety ─────────────────────────────────────────────────
|
|
14
|
+
const git = getGitState();
|
|
15
|
+
if (!git.isGitRepo) {
|
|
16
|
+
showNotGitRepo();
|
|
17
|
+
process.exit(0);
|
|
18
|
+
}
|
|
19
|
+
showBranchInfo(git.branch);
|
|
20
|
+
if (git.isDirty) {
|
|
21
|
+
showDirtyWarning();
|
|
22
|
+
const proceed = await confirm(" continue with uncommitted changes? (y/n) ");
|
|
23
|
+
if (!proceed) {
|
|
24
|
+
process.exit(0);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
// ── 2. Collect context ────────────────────────────────────────────
|
|
28
|
+
const root = process.cwd();
|
|
29
|
+
const context = collectRepoContext(root);
|
|
30
|
+
// ── 3. Show scan results + prompt ─────────────────────────────────
|
|
31
|
+
showScanResults(context);
|
|
32
|
+
let choice = await promptChoice(" proceed? [y] add more files? [a] cancel? [n] ");
|
|
33
|
+
while (choice === "a") {
|
|
34
|
+
const filePath = await promptFilePath(" file path: ");
|
|
35
|
+
if (filePath) {
|
|
36
|
+
const added = addFileToContext(root, filePath, context);
|
|
37
|
+
if (!added) {
|
|
38
|
+
console.log(` could not read ${filePath}\n`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
showScanResults(context);
|
|
42
|
+
choice = await promptChoice(" proceed? [y] add more files? [a] cancel? [n] ");
|
|
43
|
+
}
|
|
44
|
+
if (choice === "n") {
|
|
45
|
+
process.exit(0);
|
|
46
|
+
}
|
|
47
|
+
// ── 4. Call API ───────────────────────────────────────────────────
|
|
48
|
+
const spinner = ora({
|
|
49
|
+
text: "relay is reading your repository...",
|
|
50
|
+
color: "yellow",
|
|
51
|
+
}).start();
|
|
52
|
+
console.log("calling:", API_URL);
|
|
53
|
+
let response;
|
|
54
|
+
try {
|
|
55
|
+
const controller = new AbortController();
|
|
56
|
+
const timeout = setTimeout(() => controller.abort(), TIMEOUT_MS);
|
|
57
|
+
response = await fetch(API_URL, {
|
|
58
|
+
method: "POST",
|
|
59
|
+
headers: { "Content-Type": "application/json" },
|
|
60
|
+
body: JSON.stringify(context),
|
|
61
|
+
signal: controller.signal,
|
|
62
|
+
});
|
|
63
|
+
clearTimeout(timeout);
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
spinner.stop();
|
|
67
|
+
if (err instanceof Error && err.name === "AbortError") {
|
|
68
|
+
showError("network", "request timed out after 120s");
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
showError("network");
|
|
72
|
+
}
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
if (!response.ok) {
|
|
76
|
+
spinner.stop();
|
|
77
|
+
const body = (await response.json().catch(() => ({})));
|
|
78
|
+
const msg = (body.message ?? body.error);
|
|
79
|
+
if (response.status === 429) {
|
|
80
|
+
showError("rate-limit");
|
|
81
|
+
}
|
|
82
|
+
else if (response.status === 400) {
|
|
83
|
+
showError("validation", msg);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
showError("server", msg);
|
|
87
|
+
}
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
let data;
|
|
91
|
+
try {
|
|
92
|
+
data = (await response.json());
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
spinner.stop();
|
|
96
|
+
showError("server", "invalid response from relay");
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
spinner.stop();
|
|
100
|
+
console.log();
|
|
101
|
+
// ── 5. Show findings + file list ──────────────────────────────────
|
|
102
|
+
showSummary(data.summary);
|
|
103
|
+
showFindings(data.findings);
|
|
104
|
+
showFileList(data.files);
|
|
105
|
+
// ── 6. Confirm write ──────────────────────────────────────────────
|
|
106
|
+
const writeConfirm = await confirm(" write these files? (y/n) ");
|
|
107
|
+
if (!writeConfirm) {
|
|
108
|
+
process.exit(0);
|
|
109
|
+
}
|
|
110
|
+
// ── 7. Re-check git before writing ────────────────────────────────
|
|
111
|
+
const gitNow = getGitState();
|
|
112
|
+
if (gitNow.isDirty && !git.isDirty) {
|
|
113
|
+
const proceed = await confirm(" working tree changed since scan — continue? (y/n) ");
|
|
114
|
+
if (!proceed) {
|
|
115
|
+
process.exit(0);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// ── 8. Write + commit ─────────────────────────────────────────────
|
|
119
|
+
console.log();
|
|
120
|
+
writeFiles(root, data.files);
|
|
121
|
+
console.log();
|
|
122
|
+
const committed = commitFiles(root, data.files);
|
|
123
|
+
if (!committed) {
|
|
124
|
+
console.log(" ⚠ files written but git commit failed\n");
|
|
125
|
+
}
|
|
126
|
+
// ── 9. Success ────────────────────────────────────────────────────
|
|
127
|
+
showSuccess();
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,E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mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAgG/C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAkG5D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAM9F"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { getGitState } from "./git.js";
|
|
4
|
+
const IGNORE_DIRS = new Set([
|
|
5
|
+
"node_modules", ".git", "dist", ".next", ".vercel", ".turbo",
|
|
6
|
+
"__pycache__", ".cache", "coverage", ".nyc_output", "build",
|
|
7
|
+
]);
|
|
8
|
+
const CONFIG_PATTERNS = [
|
|
9
|
+
"next.config.ts", "next.config.js", "next.config.mjs",
|
|
10
|
+
"tailwind.config.ts", "tailwind.config.js",
|
|
11
|
+
"supabase/config.toml",
|
|
12
|
+
"vercel.json",
|
|
13
|
+
"prisma/schema.prisma",
|
|
14
|
+
"drizzle.config.ts",
|
|
15
|
+
".eslintrc.json", ".eslintrc.js", "eslint.config.js", "eslint.config.mjs",
|
|
16
|
+
".prettierrc", ".prettierrc.json",
|
|
17
|
+
"jest.config.ts", "jest.config.js",
|
|
18
|
+
"vitest.config.ts", "vitest.config.js",
|
|
19
|
+
"playwright.config.ts",
|
|
20
|
+
];
|
|
21
|
+
function readJsonSafe(filePath) {
|
|
22
|
+
try {
|
|
23
|
+
const raw = fs.readFileSync(filePath, "utf-8");
|
|
24
|
+
return JSON.parse(raw);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function readFileSafe(filePath) {
|
|
31
|
+
try {
|
|
32
|
+
return fs.readFileSync(filePath, "utf-8");
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function getDirectoryTree(root, maxDepth = 2) {
|
|
39
|
+
const entries = [];
|
|
40
|
+
function walk(dir, depth, prefix) {
|
|
41
|
+
if (depth > maxDepth)
|
|
42
|
+
return;
|
|
43
|
+
let items;
|
|
44
|
+
try {
|
|
45
|
+
items = fs.readdirSync(dir, { withFileTypes: true });
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
for (const item of items) {
|
|
51
|
+
if (IGNORE_DIRS.has(item.name))
|
|
52
|
+
continue;
|
|
53
|
+
if (item.name.startsWith(".") && depth === 0 && item.isDirectory())
|
|
54
|
+
continue;
|
|
55
|
+
const relative = prefix ? `${prefix}/${item.name}` : item.name;
|
|
56
|
+
if (item.isDirectory()) {
|
|
57
|
+
entries.push(`${relative}/`);
|
|
58
|
+
walk(path.join(dir, item.name), depth + 1, relative);
|
|
59
|
+
}
|
|
60
|
+
else if (depth <= 1) {
|
|
61
|
+
entries.push(relative);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
walk(root, 0, "");
|
|
66
|
+
return entries;
|
|
67
|
+
}
|
|
68
|
+
function getRootConfigs(root) {
|
|
69
|
+
const configPatterns = [
|
|
70
|
+
/^\..*rc$/,
|
|
71
|
+
/^\..*rc\.json$/,
|
|
72
|
+
/^\..*rc\.js$/,
|
|
73
|
+
/^\..*rc\.yml$/,
|
|
74
|
+
/^\..*rc\.yaml$/,
|
|
75
|
+
/\.config\.(ts|js|mjs|cjs)$/,
|
|
76
|
+
/^tsconfig.*\.json$/,
|
|
77
|
+
/^docker-compose.*\.ya?ml$/,
|
|
78
|
+
/^Dockerfile/,
|
|
79
|
+
/^Makefile$/,
|
|
80
|
+
/^\.env\.example$/,
|
|
81
|
+
];
|
|
82
|
+
try {
|
|
83
|
+
const items = fs.readdirSync(root);
|
|
84
|
+
return items.filter((item) => {
|
|
85
|
+
return configPatterns.some((p) => p.test(item));
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
export function collectRepoContext(root) {
|
|
93
|
+
// ── package.json ──
|
|
94
|
+
const pkgJson = readJsonSafe(path.join(root, "package.json"));
|
|
95
|
+
const packageJson = pkgJson
|
|
96
|
+
? {
|
|
97
|
+
name: pkgJson.name,
|
|
98
|
+
description: pkgJson.description,
|
|
99
|
+
dependencies: (pkgJson.dependencies ?? {}),
|
|
100
|
+
devDependencies: (pkgJson.devDependencies ?? {}),
|
|
101
|
+
scripts: (pkgJson.scripts ?? {}),
|
|
102
|
+
workspaces: pkgJson.workspaces,
|
|
103
|
+
}
|
|
104
|
+
: { dependencies: {}, devDependencies: {}, scripts: {} };
|
|
105
|
+
// ── tsconfig.json ──
|
|
106
|
+
const tsconfig = readJsonSafe(path.join(root, "tsconfig.json"));
|
|
107
|
+
// ── Directory tree ──
|
|
108
|
+
const directoryTree = getDirectoryTree(root);
|
|
109
|
+
// ── .env.example — key names only ──
|
|
110
|
+
const envKeys = [];
|
|
111
|
+
const envContent = readFileSafe(path.join(root, ".env.example"));
|
|
112
|
+
if (envContent) {
|
|
113
|
+
for (const line of envContent.split("\n")) {
|
|
114
|
+
const trimmed = line.trim();
|
|
115
|
+
if (trimmed && !trimmed.startsWith("#")) {
|
|
116
|
+
const key = trimmed.split("=")[0].trim();
|
|
117
|
+
if (key)
|
|
118
|
+
envKeys.push(key);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
// ── Config files ──
|
|
123
|
+
const configFiles = {};
|
|
124
|
+
for (const pattern of CONFIG_PATTERNS) {
|
|
125
|
+
const fullPath = path.join(root, pattern);
|
|
126
|
+
const content = readFileSafe(fullPath);
|
|
127
|
+
if (content) {
|
|
128
|
+
// Cap config file content at 5000 chars
|
|
129
|
+
configFiles[pattern] = content.slice(0, 5000);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// ── Existing rules ──
|
|
133
|
+
const existingRules = {};
|
|
134
|
+
// .cursor/rules/
|
|
135
|
+
const cursorRulesDir = path.join(root, ".cursor", "rules");
|
|
136
|
+
try {
|
|
137
|
+
const ruleFiles = fs.readdirSync(cursorRulesDir);
|
|
138
|
+
for (const file of ruleFiles) {
|
|
139
|
+
const content = readFileSafe(path.join(cursorRulesDir, file));
|
|
140
|
+
if (content) {
|
|
141
|
+
existingRules[`.cursor/rules/${file}`] = content;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
// no existing rules
|
|
147
|
+
}
|
|
148
|
+
// CLAUDE.md
|
|
149
|
+
const claudeMd = readFileSafe(path.join(root, "CLAUDE.md"));
|
|
150
|
+
if (claudeMd) {
|
|
151
|
+
existingRules["CLAUDE.md"] = claudeMd;
|
|
152
|
+
}
|
|
153
|
+
// ── Migrations ──
|
|
154
|
+
let migrationCount = 0;
|
|
155
|
+
let migrationNames = [];
|
|
156
|
+
const migrationsDir = path.join(root, "supabase", "migrations");
|
|
157
|
+
try {
|
|
158
|
+
const migFiles = fs.readdirSync(migrationsDir).filter((f) => f.endsWith(".sql"));
|
|
159
|
+
migrationCount = migFiles.length;
|
|
160
|
+
migrationNames = migFiles;
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
// no migrations
|
|
164
|
+
}
|
|
165
|
+
// ── Root configs ──
|
|
166
|
+
const rootConfigs = getRootConfigs(root);
|
|
167
|
+
// ── Git state ──
|
|
168
|
+
const git = getGitState();
|
|
169
|
+
const gitState = git.isGitRepo ? { branch: git.branch, isDirty: git.isDirty } : null;
|
|
170
|
+
return {
|
|
171
|
+
packageJson,
|
|
172
|
+
tsconfig,
|
|
173
|
+
directoryTree,
|
|
174
|
+
envKeys,
|
|
175
|
+
configFiles,
|
|
176
|
+
existingRules,
|
|
177
|
+
migrationCount,
|
|
178
|
+
migrationNames,
|
|
179
|
+
rootConfigs,
|
|
180
|
+
gitState,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
export function addFileToContext(root, filePath, context) {
|
|
184
|
+
const fullPath = path.resolve(root, filePath);
|
|
185
|
+
const content = readFileSafe(fullPath);
|
|
186
|
+
if (!content)
|
|
187
|
+
return false;
|
|
188
|
+
context.configFiles[filePath] = content.slice(0, 5000);
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=collector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collector.js","sourceRoot":"","sources":["../../src/context/collector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ;IAC5D,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO;CAC5D,CAAC,CAAC;AAEH,MAAM,eAAe,GAAG;IACtB,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB;IACrD,oBAAoB,EAAE,oBAAoB;IAC1C,sBAAsB;IACtB,aAAa;IACb,sBAAsB;IACtB,mBAAmB;IACnB,gBAAgB,EAAE,cAAc,EAAE,kBAAkB,EAAE,mBAAmB;IACzE,aAAa,EAAE,kBAAkB;IACjC,gBAAgB,EAAE,gBAAgB;IAClC,kBAAkB,EAAE,kBAAkB;IACtC,sBAAsB;CACvB,CAAC;AAEF,SAAS,YAAY,CAAC,QAAgB;IACpC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,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,WAAW,IAAI,QAAQ,CA2BtC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { execSync } from "node:child_process";
|
|
2
|
+
export function getGitState() {
|
|
3
|
+
try {
|
|
4
|
+
execSync("git rev-parse --is-inside-work-tree", { stdio: "pipe" });
|
|
5
|
+
}
|
|
6
|
+
catch {
|
|
7
|
+
return { isGitRepo: false, branch: "", isDirty: false };
|
|
8
|
+
}
|
|
9
|
+
let branch = "";
|
|
10
|
+
try {
|
|
11
|
+
branch = execSync("git branch --show-current", { stdio: "pipe" })
|
|
12
|
+
.toString()
|
|
13
|
+
.trim();
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
branch = "unknown";
|
|
17
|
+
}
|
|
18
|
+
let isDirty = false;
|
|
19
|
+
try {
|
|
20
|
+
const status = execSync("git status --porcelain", { stdio: "pipe" })
|
|
21
|
+
.toString()
|
|
22
|
+
.trim();
|
|
23
|
+
isDirty = status.length > 0;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
isDirty = false;
|
|
27
|
+
}
|
|
28
|
+
return { isGitRepo: true, branch, isDirty };
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/context/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAQ9C,MAAM,UAAU,WAAW;IACzB,IAAI,CAAC;QACH,QAAQ,CAAC,qCAAqC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC1D,CAAC;IAED,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,CAAC;QACH,MAAM,GAAG,QAAQ,CAAC,2BAA2B,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;aAC9D,QAAQ,EAAE;aACV,IAAI,EAAE,CAAC;IACZ,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,GAAG,SAAS,CAAC;IACrB,CAAC;IAED,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,QAAQ,CAAC,wBAAwB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;aACjE,QAAQ,EAAE;aACV,IAAI,EAAE,CAAC;QACV,OAAO,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,KAAK,CAAC;IAClB,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC9C,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { init } from "./commands/init.js";
|
|
3
|
+
const args = process.argv.slice(2);
|
|
4
|
+
const command = args[0] ?? "init";
|
|
5
|
+
switch (command) {
|
|
6
|
+
case "init":
|
|
7
|
+
init().catch((err) => {
|
|
8
|
+
console.error(err.message ?? err);
|
|
9
|
+
process.exit(1);
|
|
10
|
+
});
|
|
11
|
+
break;
|
|
12
|
+
case "--version":
|
|
13
|
+
case "-v":
|
|
14
|
+
console.log("runshift 0.0.2");
|
|
15
|
+
break;
|
|
16
|
+
case "--help":
|
|
17
|
+
case "-h":
|
|
18
|
+
console.log(`
|
|
19
|
+
runshift — the control plane for agents, wherever they run.
|
|
20
|
+
|
|
21
|
+
Usage:
|
|
22
|
+
npx runshift init Read your repo, generate governance rules
|
|
23
|
+
|
|
24
|
+
Options:
|
|
25
|
+
--version, -v Show version
|
|
26
|
+
--help, -h Show this help
|
|
27
|
+
`);
|
|
28
|
+
break;
|
|
29
|
+
default:
|
|
30
|
+
console.error(`Unknown command: ${command}\nRun "runshift --help" for usage.`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAE1C,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC;AAElC,QAAQ,OAAO,EAAE,CAAC;IAChB,KAAK,MAAM;QACT,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACnB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,CAAC;YAClC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;QACH,MAAM;IACR,KAAK,WAAW,CAAC;IACjB,KAAK,IAAI;QACP,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC9B,MAAM;IACR,KAAK,QAAQ,CAAC;IACd,KAAK,IAAI;QACP,OAAO,CAAC,GAAG,CAAC;;;;;;;;;CASf,CAAC,CAAC;QACC,MAAM;IACR;QACE,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,oCAAoC,CAAC,CAAC;QAC/E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export interface RepoContext {
|
|
2
|
+
packageJson: {
|
|
3
|
+
name?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
dependencies?: Record<string, string>;
|
|
6
|
+
devDependencies?: Record<string, string>;
|
|
7
|
+
scripts?: Record<string, string>;
|
|
8
|
+
workspaces?: string[] | {
|
|
9
|
+
packages: string[];
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
tsconfig: Record<string, unknown> | null;
|
|
13
|
+
directoryTree: string[];
|
|
14
|
+
envKeys: string[];
|
|
15
|
+
configFiles: Record<string, string>;
|
|
16
|
+
existingRules: Record<string, string>;
|
|
17
|
+
migrationCount: number;
|
|
18
|
+
migrationNames: string[];
|
|
19
|
+
rootConfigs: string[];
|
|
20
|
+
gitState: {
|
|
21
|
+
branch: string;
|
|
22
|
+
isDirty: boolean;
|
|
23
|
+
} | null;
|
|
24
|
+
}
|
|
25
|
+
export interface GeneratedFile {
|
|
26
|
+
path: string;
|
|
27
|
+
content: string;
|
|
28
|
+
action: "create" | "update";
|
|
29
|
+
}
|
|
30
|
+
export interface Findings {
|
|
31
|
+
blastRadius: string[];
|
|
32
|
+
securityGaps: string[];
|
|
33
|
+
agentFailurePatterns: string[];
|
|
34
|
+
parallelizationBoundaries: string[];
|
|
35
|
+
deprecatedPatterns: string[];
|
|
36
|
+
}
|
|
37
|
+
export interface InitResponse {
|
|
38
|
+
files: GeneratedFile[];
|
|
39
|
+
findings: Findings;
|
|
40
|
+
summary: string;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACtC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,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","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,gDAAgD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Findings, GeneratedFile, RepoContext } from "../types.js";
|
|
2
|
+
export declare function showBanner(): void;
|
|
3
|
+
export declare function showNotGitRepo(): void;
|
|
4
|
+
export declare function showDirtyWarning(): void;
|
|
5
|
+
export declare function showBranchInfo(branch: string): void;
|
|
6
|
+
export declare function showScanResults(context: RepoContext): void;
|
|
7
|
+
export declare function showFindings(findings: Findings): void;
|
|
8
|
+
export declare function showFileList(files: GeneratedFile[]): void;
|
|
9
|
+
export declare function showWriting(filePath: string): void;
|
|
10
|
+
export declare function showCommit(): void;
|
|
11
|
+
export declare function showSummary(summary: string): void;
|
|
12
|
+
export declare function showSuccess(): void;
|
|
13
|
+
export declare function showError(type: "network" | "rate-limit" | "validation" | "server", message?: string): void;
|
|
14
|
+
//# sourceMappingURL=display.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/ui/display.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAOxE,wBAAgB,UAAU,IAAI,IAAI,CASjC;AAED,wBAAgB,cAAc,IAAI,IAAI,CAGrC;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEnD;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAqD1D;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAsBrD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,IAAI,CAQzD;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAElD;AAED,wBAAgB,UAAU,IAAI,IAAI,CAEjC;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEjD;AAED,wBAAgB,WAAW,IAAI,IAAI,CAQlC;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,GAAG,YAAY,GAAG,YAAY,GAAG,QAAQ,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAmB1G"}
|