@gh-symphony/cli 0.0.14 → 0.0.15
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/dist/chunk-5NV3LSAJ.js +11 -0
- package/dist/chunk-6HBZC3BE.js +468 -0
- package/dist/chunk-76QPITKI.js +109 -0
- package/dist/chunk-IWR4UQEJ.js +2250 -0
- package/dist/chunk-JO3AXHQI.js +130 -0
- package/dist/chunk-M7OSMUTN.js +874 -0
- package/dist/chunk-MVRF7BES.js +68 -0
- package/dist/chunk-RNWX7DQU.js +4617 -0
- package/dist/chunk-ROGRTUFI.js +108 -0
- package/dist/chunk-TH5QPO3Y.js +67 -0
- package/dist/config-cmd-AZ7POMAA.js +110 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +568 -356
- package/dist/init-EZXQAXZM.js +17 -0
- package/dist/logs-6LNGT2GF.js +188 -0
- package/dist/project-3ELXQ35D.js +678 -0
- package/dist/recover-T6ME6C56.js +130 -0
- package/dist/repo-R3XBIVAX.js +121 -0
- package/dist/run-DYINRZHK.js +107 -0
- package/dist/start-PIFQMIC2.js +15 -0
- package/dist/status-3WK5BWRZ.js +11 -0
- package/dist/stop-AA3AP5M6.js +9 -0
- package/dist/version-VBB62JWI.js +30 -0
- package/package.json +9 -4
- package/dist/ansi.d.ts +0 -15
- package/dist/ansi.js +0 -53
- package/dist/commands/config-cmd.d.ts +0 -3
- package/dist/commands/config-cmd.js +0 -90
- package/dist/commands/help.d.ts +0 -3
- package/dist/commands/help.js +0 -55
- package/dist/commands/init.d.ts +0 -34
- package/dist/commands/init.js +0 -477
- package/dist/commands/logs.d.ts +0 -3
- package/dist/commands/logs.js +0 -184
- package/dist/commands/project.d.ts +0 -3
- package/dist/commands/project.js +0 -649
- package/dist/commands/recover.d.ts +0 -3
- package/dist/commands/recover.js +0 -119
- package/dist/commands/repo.d.ts +0 -3
- package/dist/commands/repo.js +0 -103
- package/dist/commands/run.d.ts +0 -3
- package/dist/commands/run.js +0 -95
- package/dist/commands/start.d.ts +0 -20
- package/dist/commands/start.js +0 -344
- package/dist/commands/status-refresh.d.ts +0 -9
- package/dist/commands/status-refresh.js +0 -27
- package/dist/commands/status.d.ts +0 -3
- package/dist/commands/status.js +0 -237
- package/dist/commands/stop.d.ts +0 -3
- package/dist/commands/stop.js +0 -92
- package/dist/commands/version.d.ts +0 -3
- package/dist/commands/version.js +0 -21
- package/dist/completion.d.ts +0 -1
- package/dist/completion.js +0 -204
- package/dist/config.d.ts +0 -38
- package/dist/config.js +0 -82
- package/dist/context/context-types.d.ts +0 -36
- package/dist/context/context-types.js +0 -1
- package/dist/context/generate-context-yaml.d.ts +0 -15
- package/dist/context/generate-context-yaml.js +0 -129
- package/dist/dashboard/renderer.d.ts +0 -9
- package/dist/dashboard/renderer.js +0 -220
- package/dist/detection/environment-detector.d.ts +0 -11
- package/dist/detection/environment-detector.js +0 -140
- package/dist/github/client.d.ts +0 -71
- package/dist/github/client.js +0 -348
- package/dist/github/gh-auth.d.ts +0 -34
- package/dist/github/gh-auth.js +0 -110
- package/dist/mapping/smart-defaults.d.ts +0 -17
- package/dist/mapping/smart-defaults.js +0 -86
- package/dist/orchestrator-runtime.d.ts +0 -1
- package/dist/orchestrator-runtime.js +0 -4
- package/dist/orchestrator-status-endpoint.d.ts +0 -5
- package/dist/orchestrator-status-endpoint.js +0 -27
- package/dist/project-selection.d.ts +0 -8
- package/dist/project-selection.js +0 -56
- package/dist/skills/skill-writer.d.ts +0 -14
- package/dist/skills/skill-writer.js +0 -62
- package/dist/skills/templates/commit.d.ts +0 -2
- package/dist/skills/templates/commit.js +0 -45
- package/dist/skills/templates/document.d.ts +0 -7
- package/dist/skills/templates/document.js +0 -16
- package/dist/skills/templates/gh-project.d.ts +0 -2
- package/dist/skills/templates/gh-project.js +0 -88
- package/dist/skills/templates/gh-symphony.d.ts +0 -2
- package/dist/skills/templates/gh-symphony.js +0 -125
- package/dist/skills/templates/index.d.ts +0 -8
- package/dist/skills/templates/index.js +0 -28
- package/dist/skills/templates/land.d.ts +0 -2
- package/dist/skills/templates/land.js +0 -59
- package/dist/skills/templates/pull.d.ts +0 -2
- package/dist/skills/templates/pull.js +0 -41
- package/dist/skills/templates/push.d.ts +0 -2
- package/dist/skills/templates/push.js +0 -36
- package/dist/skills/types.d.ts +0 -23
- package/dist/skills/types.js +0 -1
- package/dist/workflow/generate-reference-workflow.d.ts +0 -9
- package/dist/workflow/generate-reference-workflow.js +0 -261
- package/dist/workflow/generate-workflow-md.d.ts +0 -12
- package/dist/workflow/generate-workflow-md.js +0 -134
package/dist/commands/logs.js
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { readFile, readdir, stat } from "node:fs/promises";
|
|
2
|
-
import { join, resolve } from "node:path";
|
|
3
|
-
import { createReadStream } from "node:fs";
|
|
4
|
-
import { createInterface } from "node:readline";
|
|
5
|
-
import { orchestratorLogPath } from "../config.js";
|
|
6
|
-
import { handleMissingManagedProjectConfig, resolveManagedProjectConfig, } from "../project-selection.js";
|
|
7
|
-
function parseLogsArgs(args) {
|
|
8
|
-
const parsed = { follow: false };
|
|
9
|
-
for (let i = 0; i < args.length; i += 1) {
|
|
10
|
-
const arg = args[i];
|
|
11
|
-
if (arg === "--follow" || arg === "-f") {
|
|
12
|
-
parsed.follow = true;
|
|
13
|
-
}
|
|
14
|
-
if (arg === "--issue") {
|
|
15
|
-
parsed.issue = args[i + 1];
|
|
16
|
-
i += 1;
|
|
17
|
-
}
|
|
18
|
-
if (arg === "--run") {
|
|
19
|
-
parsed.run = args[i + 1];
|
|
20
|
-
i += 1;
|
|
21
|
-
}
|
|
22
|
-
if (arg === "--level") {
|
|
23
|
-
parsed.level = args[i + 1];
|
|
24
|
-
i += 1;
|
|
25
|
-
}
|
|
26
|
-
if (arg === "--project" || arg === "--project-id") {
|
|
27
|
-
parsed.projectId = args[i + 1];
|
|
28
|
-
i += 1;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return parsed;
|
|
32
|
-
}
|
|
33
|
-
const handler = async (args, options) => {
|
|
34
|
-
const parsed = parseLogsArgs(args);
|
|
35
|
-
const runtimeRoot = resolve(options.configDir);
|
|
36
|
-
// If --run is specified, read that run's events
|
|
37
|
-
if (parsed.run) {
|
|
38
|
-
const eventsPath = parsed.projectId
|
|
39
|
-
? join(runtimeRoot, "projects", parsed.projectId, "runs", parsed.run, "events.ndjson")
|
|
40
|
-
: await resolveRunEventsPath(runtimeRoot, parsed.run);
|
|
41
|
-
if (!eventsPath) {
|
|
42
|
-
process.stderr.write(`No events found for run: ${parsed.run}\n`);
|
|
43
|
-
process.exitCode = 1;
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
try {
|
|
47
|
-
const content = await readFile(eventsPath, "utf8");
|
|
48
|
-
const lines = content.trim().split("\n").filter(Boolean);
|
|
49
|
-
for (const line of lines) {
|
|
50
|
-
const event = JSON.parse(line);
|
|
51
|
-
if (parsed.projectId && event.projectId !== parsed.projectId)
|
|
52
|
-
continue;
|
|
53
|
-
if (parsed.level && event.level !== parsed.level)
|
|
54
|
-
continue;
|
|
55
|
-
if (parsed.issue && event.issueIdentifier !== parsed.issue)
|
|
56
|
-
continue;
|
|
57
|
-
process.stdout.write(formatEvent(event) + "\n");
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
catch {
|
|
61
|
-
process.stderr.write(`No events found for run: ${parsed.run}\n`);
|
|
62
|
-
process.exitCode = 1;
|
|
63
|
-
}
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
// Default: read orchestrator log or scan all events
|
|
67
|
-
if (parsed.follow) {
|
|
68
|
-
const projectConfig = await resolveManagedProjectConfig({
|
|
69
|
-
configDir: options.configDir,
|
|
70
|
-
requestedProjectId: parsed.projectId,
|
|
71
|
-
});
|
|
72
|
-
if (!projectConfig) {
|
|
73
|
-
handleMissingManagedProjectConfig();
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const logPath = orchestratorLogPath(options.configDir, projectConfig.projectId);
|
|
77
|
-
try {
|
|
78
|
-
const stream = createReadStream(logPath, { encoding: "utf8" });
|
|
79
|
-
const rl = createInterface({ input: stream });
|
|
80
|
-
for await (const line of rl) {
|
|
81
|
-
process.stdout.write(line + "\n");
|
|
82
|
-
}
|
|
83
|
-
// Follow mode: watch for new lines
|
|
84
|
-
const { watchFile } = await import("node:fs");
|
|
85
|
-
let lastSize = 0;
|
|
86
|
-
watchFile(logPath, { interval: 1000 }, async (curr) => {
|
|
87
|
-
if (curr.size > lastSize) {
|
|
88
|
-
const fd = await import("node:fs/promises");
|
|
89
|
-
const handle = await fd.open(logPath, "r");
|
|
90
|
-
const buf = Buffer.alloc(curr.size - lastSize);
|
|
91
|
-
await handle.read(buf, 0, buf.length, lastSize);
|
|
92
|
-
await handle.close();
|
|
93
|
-
process.stdout.write(buf.toString("utf8"));
|
|
94
|
-
lastSize = curr.size;
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
// Keep alive
|
|
98
|
-
await new Promise(() => { });
|
|
99
|
-
}
|
|
100
|
-
catch {
|
|
101
|
-
process.stderr.write("No log file found. Start the orchestrator first.\n");
|
|
102
|
-
process.exitCode = 1;
|
|
103
|
-
}
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
// Scan all run events
|
|
107
|
-
const runRoots = parsed.projectId
|
|
108
|
-
? [join(runtimeRoot, "projects", parsed.projectId, "runs")]
|
|
109
|
-
: await listProjectRunRoots(runtimeRoot);
|
|
110
|
-
let foundRuns = false;
|
|
111
|
-
try {
|
|
112
|
-
for (const runsDir of runRoots) {
|
|
113
|
-
const entries = await safeReadDir(runsDir);
|
|
114
|
-
if (entries.length === 0) {
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
foundRuns = true;
|
|
118
|
-
for (const entry of entries) {
|
|
119
|
-
const eventsPath = join(runsDir, entry, "events.ndjson");
|
|
120
|
-
try {
|
|
121
|
-
const content = await readFile(eventsPath, "utf8");
|
|
122
|
-
const lines = content.trim().split("\n").filter(Boolean);
|
|
123
|
-
for (const line of lines) {
|
|
124
|
-
const event = JSON.parse(line);
|
|
125
|
-
if (parsed.projectId && event.projectId !== parsed.projectId)
|
|
126
|
-
continue;
|
|
127
|
-
if (parsed.level && event.level !== parsed.level)
|
|
128
|
-
continue;
|
|
129
|
-
if (parsed.issue && event.issueIdentifier !== parsed.issue)
|
|
130
|
-
continue;
|
|
131
|
-
process.stdout.write(formatEvent(event) + "\n");
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
catch {
|
|
135
|
-
// Skip runs without events
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
catch {
|
|
141
|
-
// fall through to friendly error below
|
|
142
|
-
}
|
|
143
|
-
if (!foundRuns) {
|
|
144
|
-
process.stderr.write("No runs found. Start the orchestrator first.\n");
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
export default handler;
|
|
148
|
-
function formatEvent(event) {
|
|
149
|
-
const at = event.at ?? "";
|
|
150
|
-
const eventType = event.event ?? "unknown";
|
|
151
|
-
const issue = event.issueIdentifier ?? "";
|
|
152
|
-
const extra = event.error ? ` error=${event.error}` : "";
|
|
153
|
-
return `[${at}] ${eventType} ${issue}${extra}`;
|
|
154
|
-
}
|
|
155
|
-
async function listProjectRunRoots(runtimeRoot) {
|
|
156
|
-
try {
|
|
157
|
-
const projectIds = await readdir(join(runtimeRoot, "projects"));
|
|
158
|
-
return projectIds.map((projectId) => join(runtimeRoot, "projects", projectId, "runs"));
|
|
159
|
-
}
|
|
160
|
-
catch {
|
|
161
|
-
return [];
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
async function resolveRunEventsPath(runtimeRoot, runId) {
|
|
165
|
-
for (const runsDir of await listProjectRunRoots(runtimeRoot)) {
|
|
166
|
-
const eventsPath = join(runsDir, runId, "events.ndjson");
|
|
167
|
-
try {
|
|
168
|
-
await stat(eventsPath);
|
|
169
|
-
return eventsPath;
|
|
170
|
-
}
|
|
171
|
-
catch {
|
|
172
|
-
// Continue searching.
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
return null;
|
|
176
|
-
}
|
|
177
|
-
async function safeReadDir(path) {
|
|
178
|
-
try {
|
|
179
|
-
return await readdir(path);
|
|
180
|
-
}
|
|
181
|
-
catch {
|
|
182
|
-
return [];
|
|
183
|
-
}
|
|
184
|
-
}
|