sentinelayer-cli 0.1.2 → 0.3.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.
Files changed (127) hide show
  1. package/README.md +996 -996
  2. package/bin/create-sentinelayer.js +5 -5
  3. package/bin/sentinelayer-cli.js +4 -4
  4. package/bin/sl.js +5 -5
  5. package/package.json +62 -54
  6. package/src/agents/jules/config/definition.js +209 -209
  7. package/src/agents/jules/config/system-prompt.js +175 -175
  8. package/src/agents/jules/error-intake.js +51 -51
  9. package/src/agents/jules/fix-cycle.js +377 -377
  10. package/src/agents/jules/loop.js +367 -367
  11. package/src/agents/jules/pulse.js +319 -319
  12. package/src/agents/jules/stream.js +186 -186
  13. package/src/agents/jules/swarm/file-scanner.js +74 -74
  14. package/src/agents/jules/swarm/index.js +11 -11
  15. package/src/agents/jules/swarm/orchestrator.js +362 -362
  16. package/src/agents/jules/swarm/pattern-hunter.js +123 -123
  17. package/src/agents/jules/swarm/sub-agent.js +308 -308
  18. package/src/agents/jules/tools/auth-audit.js +226 -222
  19. package/src/agents/jules/tools/dispatch.js +327 -327
  20. package/src/agents/jules/tools/file-edit.js +180 -180
  21. package/src/agents/jules/tools/file-read.js +100 -100
  22. package/src/agents/jules/tools/frontend-analyze.js +570 -570
  23. package/src/agents/jules/tools/glob.js +168 -168
  24. package/src/agents/jules/tools/grep.js +228 -228
  25. package/src/agents/jules/tools/index.js +29 -29
  26. package/src/agents/jules/tools/path-guards.js +161 -161
  27. package/src/agents/jules/tools/runtime-audit.js +493 -493
  28. package/src/agents/jules/tools/shell.js +383 -383
  29. package/src/ai/aidenid.js +972 -945
  30. package/src/ai/client.js +508 -508
  31. package/src/ai/domain-target-store.js +268 -268
  32. package/src/ai/identity-store.js +270 -270
  33. package/src/ai/site-store.js +145 -145
  34. package/src/audit/agents/architecture.js +180 -180
  35. package/src/audit/agents/compliance.js +179 -179
  36. package/src/audit/agents/documentation.js +165 -165
  37. package/src/audit/agents/performance.js +145 -145
  38. package/src/audit/agents/security.js +215 -215
  39. package/src/audit/agents/testing.js +172 -172
  40. package/src/audit/orchestrator.js +557 -557
  41. package/src/audit/package.js +204 -204
  42. package/src/audit/registry.js +284 -284
  43. package/src/audit/replay.js +103 -103
  44. package/src/auth/http.js +113 -113
  45. package/src/auth/service.js +891 -848
  46. package/src/auth/session-store.js +359 -345
  47. package/src/cli.js +252 -252
  48. package/src/commands/ai/identity-lifecycle.js +1338 -1337
  49. package/src/commands/ai/provision-governance.js +1272 -1246
  50. package/src/commands/ai/shared.js +147 -147
  51. package/src/commands/ai.js +11 -11
  52. package/src/commands/apply.js +12 -12
  53. package/src/commands/audit.js +1166 -1166
  54. package/src/commands/auth.js +375 -366
  55. package/src/commands/chat.js +191 -191
  56. package/src/commands/config.js +184 -184
  57. package/src/commands/cost.js +311 -311
  58. package/src/commands/daemon/core.js +850 -850
  59. package/src/commands/daemon/extended.js +1048 -1048
  60. package/src/commands/daemon/shared.js +213 -213
  61. package/src/commands/daemon.js +11 -11
  62. package/src/commands/guide.js +174 -174
  63. package/src/commands/ingest.js +58 -58
  64. package/src/commands/init.js +55 -55
  65. package/src/commands/legacy-args.js +10 -10
  66. package/src/commands/mcp.js +461 -404
  67. package/src/commands/omargate.js +15 -15
  68. package/src/commands/persona.js +20 -20
  69. package/src/commands/plugin.js +260 -260
  70. package/src/commands/policy.js +132 -132
  71. package/src/commands/prompt.js +238 -238
  72. package/src/commands/review.js +704 -704
  73. package/src/commands/scan.js +866 -788
  74. package/src/commands/spec.js +716 -716
  75. package/src/commands/swarm.js +651 -651
  76. package/src/commands/telemetry.js +202 -202
  77. package/src/commands/watch.js +510 -510
  78. package/src/config/agent-dictionary.js +182 -182
  79. package/src/config/io.js +56 -56
  80. package/src/config/paths.js +18 -18
  81. package/src/config/schema.js +55 -55
  82. package/src/config/service.js +184 -184
  83. package/src/cost/budget.js +235 -235
  84. package/src/cost/history.js +188 -188
  85. package/src/cost/tracker.js +171 -171
  86. package/src/daemon/artifact-lineage.js +534 -534
  87. package/src/daemon/assignment-ledger.js +770 -770
  88. package/src/daemon/ast-parser-layer.js +258 -258
  89. package/src/daemon/budget-governor.js +633 -633
  90. package/src/daemon/callgraph-overlay.js +646 -646
  91. package/src/daemon/error-worker.js +626 -626
  92. package/src/daemon/hybrid-mapper.js +929 -929
  93. package/src/daemon/jira-lifecycle.js +632 -632
  94. package/src/daemon/operator-control.js +657 -657
  95. package/src/daemon/reliability-lane.js +471 -471
  96. package/src/daemon/watchdog.js +971 -971
  97. package/src/guide/generator.js +316 -316
  98. package/src/ingest/engine.js +918 -918
  99. package/src/legacy-cli.js +2548 -2435
  100. package/src/mcp/registry.js +695 -695
  101. package/src/memory/blackboard.js +301 -301
  102. package/src/memory/retrieval.js +581 -581
  103. package/src/plugin/manifest.js +553 -553
  104. package/src/policy/packs.js +144 -144
  105. package/src/prompt/generator.js +118 -106
  106. package/src/review/ai-review.js +669 -669
  107. package/src/review/local-review.js +1284 -1284
  108. package/src/review/replay.js +235 -235
  109. package/src/review/report.js +664 -664
  110. package/src/review/spec-binding.js +487 -487
  111. package/src/scaffold/generator.js +67 -0
  112. package/src/scaffold/templates.js +150 -0
  113. package/src/scan/generator.js +418 -351
  114. package/src/scan/gh-secrets.js +107 -0
  115. package/src/spec/generator.js +519 -519
  116. package/src/spec/regenerate.js +237 -237
  117. package/src/spec/templates.js +91 -91
  118. package/src/swarm/dashboard.js +247 -247
  119. package/src/swarm/factory.js +363 -363
  120. package/src/swarm/pentest.js +934 -934
  121. package/src/swarm/registry.js +419 -419
  122. package/src/swarm/report.js +158 -158
  123. package/src/swarm/runtime.js +576 -576
  124. package/src/swarm/scenario-dsl.js +272 -272
  125. package/src/telemetry/ledger.js +302 -302
  126. package/src/telemetry/sync.js +96 -59
  127. package/src/ui/markdown.js +220 -220
@@ -1,174 +1,174 @@
1
- import fs from "node:fs";
2
- import fsp from "node:fs/promises";
3
- import path from "node:path";
4
-
5
- import pc from "picocolors";
6
-
7
- import {
8
- defaultGuideExportFileName,
9
- generateBuildGuide,
10
- renderGuideExport,
11
- SUPPORTED_GUIDE_EXPORT_FORMATS,
12
- } from "../guide/generator.js";
13
- import { renderTerminalMarkdown } from "../ui/markdown.js";
14
-
15
- function shouldEmitJson(options, command) {
16
- const local = Boolean(options && options.json);
17
- const globalFromCommand =
18
- command && command.optsWithGlobals ? Boolean(command.optsWithGlobals().json) : false;
19
- return local || globalFromCommand;
20
- }
21
-
22
- function resolveSpecPath(targetPath, explicitSpecFile) {
23
- const explicit = String(explicitSpecFile || "").trim();
24
- if (explicit) {
25
- return path.resolve(targetPath, explicit);
26
- }
27
-
28
- const candidates = [path.join(targetPath, "SPEC.md"), path.join(targetPath, "docs", "spec.md")];
29
- const found = candidates.find((candidate) => fs.existsSync(candidate));
30
- if (!found) {
31
- throw new Error("No spec file found. Provide --spec-file or generate SPEC.md first.");
32
- }
33
- return found;
34
- }
35
-
36
- function resolveExportFormat(rawFormat) {
37
- const normalized = String(rawFormat || "").trim().toLowerCase();
38
- if (!SUPPORTED_GUIDE_EXPORT_FORMATS.includes(normalized)) {
39
- throw new Error(
40
- `Unsupported export format '${rawFormat}'. Use one of: ${SUPPORTED_GUIDE_EXPORT_FORMATS.join(", ")}`
41
- );
42
- }
43
- return normalized;
44
- }
45
-
46
- export function registerGuideCommand(program) {
47
- const guide = program.command("guide").description("Generate and export phase-by-phase build guides");
48
-
49
- guide
50
- .command("generate")
51
- .description("Generate BUILD_GUIDE.md from SPEC content")
52
- .option("--path <path>", "Target workspace path", ".")
53
- .option("--spec-file <path>", "Spec file path relative to --path")
54
- .option("--output-file <path>", "Output guide path relative to --path", "BUILD_GUIDE.md")
55
- .option("--json", "Emit machine-readable output")
56
- .action(async (options, command) => {
57
- const targetPath = path.resolve(process.cwd(), String(options.path || "."));
58
- const outputPath = path.resolve(targetPath, String(options.outputFile || "BUILD_GUIDE.md").trim());
59
- const specPath = resolveSpecPath(targetPath, options.specFile);
60
- const specMarkdown = await fsp.readFile(specPath, "utf-8");
61
-
62
- const guideDoc = generateBuildGuide({
63
- specMarkdown,
64
- projectPath: targetPath,
65
- specPath,
66
- });
67
-
68
- await fsp.mkdir(path.dirname(outputPath), { recursive: true });
69
- await fsp.writeFile(outputPath, `${guideDoc.markdown.trimEnd()}\n`, "utf-8");
70
-
71
- const payload = {
72
- command: "guide generate",
73
- targetPath,
74
- specPath,
75
- outputPath,
76
- phases: guideDoc.phases.map((phase) => ({
77
- title: phase.title,
78
- effort: phase.effort.label,
79
- dependencies: phase.dependencies,
80
- })),
81
- };
82
-
83
- if (shouldEmitJson(options, command)) {
84
- console.log(JSON.stringify(payload, null, 2));
85
- return;
86
- }
87
-
88
- console.log(pc.bold("Build guide generated"));
89
- console.log(pc.gray(`Spec: ${specPath}`));
90
- console.log(pc.gray(`Output: ${outputPath}`));
91
- console.log(pc.gray(`Phases: ${guideDoc.phases.length}`));
92
- });
93
-
94
- guide
95
- .command("export")
96
- .description("Export build-guide phases into issue tracker-friendly format")
97
- .requiredOption(
98
- "--format <type>",
99
- `Export format (${SUPPORTED_GUIDE_EXPORT_FORMATS.join("|")})`
100
- )
101
- .option("--path <path>", "Target workspace path", ".")
102
- .option("--spec-file <path>", "Spec file path relative to --path")
103
- .option("--output-file <path>", "Output export file path relative to --path")
104
- .option("--json", "Emit machine-readable output")
105
- .action(async (options, command) => {
106
- const targetPath = path.resolve(process.cwd(), String(options.path || "."));
107
- const format = resolveExportFormat(options.format);
108
- const outputName =
109
- String(options.outputFile || "").trim() || defaultGuideExportFileName(format);
110
- const outputPath = path.resolve(targetPath, outputName);
111
- const specPath = resolveSpecPath(targetPath, options.specFile);
112
- const specMarkdown = await fsp.readFile(specPath, "utf-8");
113
-
114
- const guideDoc = generateBuildGuide({
115
- specMarkdown,
116
- projectPath: targetPath,
117
- specPath,
118
- });
119
- const exportBody = renderGuideExport({ format, guide: guideDoc });
120
-
121
- await fsp.mkdir(path.dirname(outputPath), { recursive: true });
122
- await fsp.writeFile(outputPath, `${exportBody.trimEnd()}\n`, "utf-8");
123
-
124
- const payload = {
125
- command: "guide export",
126
- format,
127
- targetPath,
128
- specPath,
129
- outputPath,
130
- issueCount: guideDoc.tickets.length,
131
- };
132
-
133
- if (shouldEmitJson(options, command)) {
134
- console.log(JSON.stringify(payload, null, 2));
135
- return;
136
- }
137
-
138
- console.log(pc.bold("Build guide export generated"));
139
- console.log(pc.gray(`Format: ${format}`));
140
- console.log(pc.gray(`Output: ${outputPath}`));
141
- console.log(pc.gray(`Issues: ${guideDoc.tickets.length}`));
142
- });
143
-
144
- guide
145
- .command("show")
146
- .description("Render an existing BUILD_GUIDE artifact in terminal markdown")
147
- .option("--path <path>", "Target workspace path", ".")
148
- .option("--file <path>", "Guide file path relative to --path", "BUILD_GUIDE.md")
149
- .option("--plain", "Disable terminal markdown styling")
150
- .option("--json", "Emit machine-readable output")
151
- .action(async (options, command) => {
152
- const targetPath = path.resolve(process.cwd(), String(options.path || "."));
153
- const guidePath = path.resolve(targetPath, String(options.file || "BUILD_GUIDE.md").trim());
154
- if (!fs.existsSync(guidePath)) {
155
- throw new Error(`Guide artifact not found: ${guidePath}`);
156
- }
157
-
158
- const markdown = await fsp.readFile(guidePath, "utf-8");
159
- const payload = {
160
- command: "guide show",
161
- guidePath,
162
- lineCount: markdown.split(/\r?\n/).length,
163
- preview: markdown,
164
- };
165
-
166
- if (shouldEmitJson(options, command)) {
167
- console.log(JSON.stringify(payload, null, 2));
168
- return;
169
- }
170
-
171
- console.log(renderTerminalMarkdown(markdown, { plain: Boolean(options.plain) }));
172
- });
173
- }
174
-
1
+ import fs from "node:fs";
2
+ import fsp from "node:fs/promises";
3
+ import path from "node:path";
4
+
5
+ import pc from "picocolors";
6
+
7
+ import {
8
+ defaultGuideExportFileName,
9
+ generateBuildGuide,
10
+ renderGuideExport,
11
+ SUPPORTED_GUIDE_EXPORT_FORMATS,
12
+ } from "../guide/generator.js";
13
+ import { renderTerminalMarkdown } from "../ui/markdown.js";
14
+
15
+ function shouldEmitJson(options, command) {
16
+ const local = Boolean(options && options.json);
17
+ const globalFromCommand =
18
+ command && command.optsWithGlobals ? Boolean(command.optsWithGlobals().json) : false;
19
+ return local || globalFromCommand;
20
+ }
21
+
22
+ function resolveSpecPath(targetPath, explicitSpecFile) {
23
+ const explicit = String(explicitSpecFile || "").trim();
24
+ if (explicit) {
25
+ return path.resolve(targetPath, explicit);
26
+ }
27
+
28
+ const candidates = [path.join(targetPath, "SPEC.md"), path.join(targetPath, "docs", "spec.md")];
29
+ const found = candidates.find((candidate) => fs.existsSync(candidate));
30
+ if (!found) {
31
+ throw new Error("No spec file found. Provide --spec-file or generate SPEC.md first.");
32
+ }
33
+ return found;
34
+ }
35
+
36
+ function resolveExportFormat(rawFormat) {
37
+ const normalized = String(rawFormat || "").trim().toLowerCase();
38
+ if (!SUPPORTED_GUIDE_EXPORT_FORMATS.includes(normalized)) {
39
+ throw new Error(
40
+ `Unsupported export format '${rawFormat}'. Use one of: ${SUPPORTED_GUIDE_EXPORT_FORMATS.join(", ")}`
41
+ );
42
+ }
43
+ return normalized;
44
+ }
45
+
46
+ export function registerGuideCommand(program) {
47
+ const guide = program.command("guide").description("Generate and export phase-by-phase build guides");
48
+
49
+ guide
50
+ .command("generate")
51
+ .description("Generate BUILD_GUIDE.md from SPEC content")
52
+ .option("--path <path>", "Target workspace path", ".")
53
+ .option("--spec-file <path>", "Spec file path relative to --path")
54
+ .option("--output-file <path>", "Output guide path relative to --path", "BUILD_GUIDE.md")
55
+ .option("--json", "Emit machine-readable output")
56
+ .action(async (options, command) => {
57
+ const targetPath = path.resolve(process.cwd(), String(options.path || "."));
58
+ const outputPath = path.resolve(targetPath, String(options.outputFile || "BUILD_GUIDE.md").trim());
59
+ const specPath = resolveSpecPath(targetPath, options.specFile);
60
+ const specMarkdown = await fsp.readFile(specPath, "utf-8");
61
+
62
+ const guideDoc = generateBuildGuide({
63
+ specMarkdown,
64
+ projectPath: targetPath,
65
+ specPath,
66
+ });
67
+
68
+ await fsp.mkdir(path.dirname(outputPath), { recursive: true });
69
+ await fsp.writeFile(outputPath, `${guideDoc.markdown.trimEnd()}\n`, "utf-8");
70
+
71
+ const payload = {
72
+ command: "guide generate",
73
+ targetPath,
74
+ specPath,
75
+ outputPath,
76
+ phases: guideDoc.phases.map((phase) => ({
77
+ title: phase.title,
78
+ effort: phase.effort.label,
79
+ dependencies: phase.dependencies,
80
+ })),
81
+ };
82
+
83
+ if (shouldEmitJson(options, command)) {
84
+ console.log(JSON.stringify(payload, null, 2));
85
+ return;
86
+ }
87
+
88
+ console.log(pc.bold("Build guide generated"));
89
+ console.log(pc.gray(`Spec: ${specPath}`));
90
+ console.log(pc.gray(`Output: ${outputPath}`));
91
+ console.log(pc.gray(`Phases: ${guideDoc.phases.length}`));
92
+ });
93
+
94
+ guide
95
+ .command("export")
96
+ .description("Export build-guide phases into issue tracker-friendly format")
97
+ .requiredOption(
98
+ "--format <type>",
99
+ `Export format (${SUPPORTED_GUIDE_EXPORT_FORMATS.join("|")})`
100
+ )
101
+ .option("--path <path>", "Target workspace path", ".")
102
+ .option("--spec-file <path>", "Spec file path relative to --path")
103
+ .option("--output-file <path>", "Output export file path relative to --path")
104
+ .option("--json", "Emit machine-readable output")
105
+ .action(async (options, command) => {
106
+ const targetPath = path.resolve(process.cwd(), String(options.path || "."));
107
+ const format = resolveExportFormat(options.format);
108
+ const outputName =
109
+ String(options.outputFile || "").trim() || defaultGuideExportFileName(format);
110
+ const outputPath = path.resolve(targetPath, outputName);
111
+ const specPath = resolveSpecPath(targetPath, options.specFile);
112
+ const specMarkdown = await fsp.readFile(specPath, "utf-8");
113
+
114
+ const guideDoc = generateBuildGuide({
115
+ specMarkdown,
116
+ projectPath: targetPath,
117
+ specPath,
118
+ });
119
+ const exportBody = renderGuideExport({ format, guide: guideDoc });
120
+
121
+ await fsp.mkdir(path.dirname(outputPath), { recursive: true });
122
+ await fsp.writeFile(outputPath, `${exportBody.trimEnd()}\n`, "utf-8");
123
+
124
+ const payload = {
125
+ command: "guide export",
126
+ format,
127
+ targetPath,
128
+ specPath,
129
+ outputPath,
130
+ issueCount: guideDoc.tickets.length,
131
+ };
132
+
133
+ if (shouldEmitJson(options, command)) {
134
+ console.log(JSON.stringify(payload, null, 2));
135
+ return;
136
+ }
137
+
138
+ console.log(pc.bold("Build guide export generated"));
139
+ console.log(pc.gray(`Format: ${format}`));
140
+ console.log(pc.gray(`Output: ${outputPath}`));
141
+ console.log(pc.gray(`Issues: ${guideDoc.tickets.length}`));
142
+ });
143
+
144
+ guide
145
+ .command("show")
146
+ .description("Render an existing BUILD_GUIDE artifact in terminal markdown")
147
+ .option("--path <path>", "Target workspace path", ".")
148
+ .option("--file <path>", "Guide file path relative to --path", "BUILD_GUIDE.md")
149
+ .option("--plain", "Disable terminal markdown styling")
150
+ .option("--json", "Emit machine-readable output")
151
+ .action(async (options, command) => {
152
+ const targetPath = path.resolve(process.cwd(), String(options.path || "."));
153
+ const guidePath = path.resolve(targetPath, String(options.file || "BUILD_GUIDE.md").trim());
154
+ if (!fs.existsSync(guidePath)) {
155
+ throw new Error(`Guide artifact not found: ${guidePath}`);
156
+ }
157
+
158
+ const markdown = await fsp.readFile(guidePath, "utf-8");
159
+ const payload = {
160
+ command: "guide show",
161
+ guidePath,
162
+ lineCount: markdown.split(/\r?\n/).length,
163
+ preview: markdown,
164
+ };
165
+
166
+ if (shouldEmitJson(options, command)) {
167
+ console.log(JSON.stringify(payload, null, 2));
168
+ return;
169
+ }
170
+
171
+ console.log(renderTerminalMarkdown(markdown, { plain: Boolean(options.plain) }));
172
+ });
173
+ }
174
+
@@ -1,58 +1,58 @@
1
- import path from "node:path";
2
-
3
- import pc from "picocolors";
4
-
5
- import { formatIngestSummary, generateCodebaseIngest } from "../ingest/engine.js";
6
-
7
- function shouldEmitJson(options, command) {
8
- const local = Boolean(options && options.json);
9
- const globalFromCommand =
10
- command && command.optsWithGlobals ? Boolean(command.optsWithGlobals().json) : false;
11
- return local || globalFromCommand;
12
- }
13
-
14
- export function registerIngestCommand(program) {
15
- const ingest = program
16
- .command("ingest")
17
- .description("Run deterministic codebase ingest and mapping");
18
-
19
- ingest
20
- .command("map")
21
- .description("Generate CODEBASE_INGEST.json with stack/risk hints")
22
- .option("--path <path>", "Target repository path", ".")
23
- .option("--output-file <path>", "Explicit output file path relative to --path")
24
- .option("--output-dir <path>", "Artifact root used when output file is not provided")
25
- .option("--json", "Emit machine-readable output")
26
- .action(async (options, command) => {
27
- const targetPath = path.resolve(process.cwd(), String(options.path || "."));
28
- const result = await generateCodebaseIngest({
29
- rootPath: targetPath,
30
- outputFile: options.outputFile,
31
- outputDir: options.outputDir,
32
- });
33
-
34
- const emitJson = shouldEmitJson(options, command);
35
- if (emitJson) {
36
- console.log(
37
- JSON.stringify(
38
- {
39
- command: "ingest map",
40
- targetPath,
41
- outputPath: result.outputPath,
42
- summary: result.ingest.summary,
43
- frameworks: result.ingest.frameworks,
44
- entryPoints: result.ingest.entryPoints,
45
- riskSurfaces: result.ingest.riskSurfaces,
46
- },
47
- null,
48
- 2
49
- )
50
- );
51
- return;
52
- }
53
-
54
- console.log(pc.bold("Codebase ingest completed"));
55
- console.log(pc.gray(`Output: ${result.outputPath}`));
56
- console.log(formatIngestSummary(result.ingest));
57
- });
58
- }
1
+ import path from "node:path";
2
+
3
+ import pc from "picocolors";
4
+
5
+ import { formatIngestSummary, generateCodebaseIngest } from "../ingest/engine.js";
6
+
7
+ function shouldEmitJson(options, command) {
8
+ const local = Boolean(options && options.json);
9
+ const globalFromCommand =
10
+ command && command.optsWithGlobals ? Boolean(command.optsWithGlobals().json) : false;
11
+ return local || globalFromCommand;
12
+ }
13
+
14
+ export function registerIngestCommand(program) {
15
+ const ingest = program
16
+ .command("ingest")
17
+ .description("Run deterministic codebase ingest and mapping");
18
+
19
+ ingest
20
+ .command("map")
21
+ .description("Generate CODEBASE_INGEST.json with stack/risk hints")
22
+ .option("--path <path>", "Target repository path", ".")
23
+ .option("--output-file <path>", "Explicit output file path relative to --path")
24
+ .option("--output-dir <path>", "Artifact root used when output file is not provided")
25
+ .option("--json", "Emit machine-readable output")
26
+ .action(async (options, command) => {
27
+ const targetPath = path.resolve(process.cwd(), String(options.path || "."));
28
+ const result = await generateCodebaseIngest({
29
+ rootPath: targetPath,
30
+ outputFile: options.outputFile,
31
+ outputDir: options.outputDir,
32
+ });
33
+
34
+ const emitJson = shouldEmitJson(options, command);
35
+ if (emitJson) {
36
+ console.log(
37
+ JSON.stringify(
38
+ {
39
+ command: "ingest map",
40
+ targetPath,
41
+ outputPath: result.outputPath,
42
+ summary: result.ingest.summary,
43
+ frameworks: result.ingest.frameworks,
44
+ entryPoints: result.ingest.entryPoints,
45
+ riskSurfaces: result.ingest.riskSurfaces,
46
+ },
47
+ null,
48
+ 2
49
+ )
50
+ );
51
+ return;
52
+ }
53
+
54
+ console.log(pc.bold("Codebase ingest completed"));
55
+ console.log(pc.gray(`Output: ${result.outputPath}`));
56
+ console.log(formatIngestSummary(result.ingest));
57
+ });
58
+ }
@@ -1,55 +1,55 @@
1
- import process from "node:process";
2
-
3
- import { loadConfig } from "../config/service.js";
4
-
5
- function applyConfigEnvDefaults(resolvedConfig) {
6
- if (!process.env.SENTINELAYER_API_URL && resolvedConfig.apiUrl) {
7
- process.env.SENTINELAYER_API_URL = resolvedConfig.apiUrl;
8
- }
9
- if (!process.env.SENTINELAYER_WEB_URL && resolvedConfig.webUrl) {
10
- process.env.SENTINELAYER_WEB_URL = resolvedConfig.webUrl;
11
- }
12
- if (!process.env.SENTINELAYER_TOKEN && resolvedConfig.sentinelayerToken) {
13
- process.env.SENTINELAYER_TOKEN = resolvedConfig.sentinelayerToken;
14
- }
15
- if (!process.env.OPENAI_API_KEY && resolvedConfig.openaiApiKey) {
16
- process.env.OPENAI_API_KEY = resolvedConfig.openaiApiKey;
17
- }
18
- if (!process.env.ANTHROPIC_API_KEY && resolvedConfig.anthropicApiKey) {
19
- process.env.ANTHROPIC_API_KEY = resolvedConfig.anthropicApiKey;
20
- }
21
- if (!process.env.GOOGLE_API_KEY && resolvedConfig.googleApiKey) {
22
- process.env.GOOGLE_API_KEY = resolvedConfig.googleApiKey;
23
- }
24
- }
25
-
26
- export function registerInitCommand(program, invokeLegacy) {
27
- program
28
- .command("init [projectName]")
29
- .description("Run scaffold/auth generation flow")
30
- .option("--non-interactive", "Disable prompts and require interview payload")
31
- .option("--interview-file <path>", "Load interview JSON from file")
32
- .option("--skip-browser-open", "Do not auto-open browser during auth")
33
- .action(async (projectName, options) => {
34
- const config = await loadConfig();
35
- applyConfigEnvDefaults(config.resolved);
36
-
37
- const legacyArgs = [];
38
- const normalizedProjectName = String(projectName || "").trim();
39
- if (normalizedProjectName) {
40
- legacyArgs.push(normalizedProjectName);
41
- }
42
- if (options.nonInteractive) {
43
- legacyArgs.push("--non-interactive");
44
- }
45
- const interviewFile = String(options.interviewFile || "").trim();
46
- if (interviewFile) {
47
- legacyArgs.push("--interview-file", interviewFile);
48
- }
49
- if (options.skipBrowserOpen) {
50
- legacyArgs.push("--skip-browser-open");
51
- }
52
-
53
- await invokeLegacy(legacyArgs);
54
- });
55
- }
1
+ import process from "node:process";
2
+
3
+ import { loadConfig } from "../config/service.js";
4
+
5
+ function applyConfigEnvDefaults(resolvedConfig) {
6
+ if (!process.env.SENTINELAYER_API_URL && resolvedConfig.apiUrl) {
7
+ process.env.SENTINELAYER_API_URL = resolvedConfig.apiUrl;
8
+ }
9
+ if (!process.env.SENTINELAYER_WEB_URL && resolvedConfig.webUrl) {
10
+ process.env.SENTINELAYER_WEB_URL = resolvedConfig.webUrl;
11
+ }
12
+ if (!process.env.SENTINELAYER_TOKEN && resolvedConfig.sentinelayerToken) {
13
+ process.env.SENTINELAYER_TOKEN = resolvedConfig.sentinelayerToken;
14
+ }
15
+ if (!process.env.OPENAI_API_KEY && resolvedConfig.openaiApiKey) {
16
+ process.env.OPENAI_API_KEY = resolvedConfig.openaiApiKey;
17
+ }
18
+ if (!process.env.ANTHROPIC_API_KEY && resolvedConfig.anthropicApiKey) {
19
+ process.env.ANTHROPIC_API_KEY = resolvedConfig.anthropicApiKey;
20
+ }
21
+ if (!process.env.GOOGLE_API_KEY && resolvedConfig.googleApiKey) {
22
+ process.env.GOOGLE_API_KEY = resolvedConfig.googleApiKey;
23
+ }
24
+ }
25
+
26
+ export function registerInitCommand(program, invokeLegacy) {
27
+ program
28
+ .command("init [projectName]")
29
+ .description("Run scaffold/auth generation flow")
30
+ .option("--non-interactive", "Disable prompts and require interview payload")
31
+ .option("--interview-file <path>", "Load interview JSON from file")
32
+ .option("--skip-browser-open", "Do not auto-open browser during auth")
33
+ .action(async (projectName, options) => {
34
+ const config = await loadConfig();
35
+ applyConfigEnvDefaults(config.resolved);
36
+
37
+ const legacyArgs = [];
38
+ const normalizedProjectName = String(projectName || "").trim();
39
+ if (normalizedProjectName) {
40
+ legacyArgs.push(normalizedProjectName);
41
+ }
42
+ if (options.nonInteractive) {
43
+ legacyArgs.push("--non-interactive");
44
+ }
45
+ const interviewFile = String(options.interviewFile || "").trim();
46
+ if (interviewFile) {
47
+ legacyArgs.push("--interview-file", interviewFile);
48
+ }
49
+ if (options.skipBrowserOpen) {
50
+ legacyArgs.push("--skip-browser-open");
51
+ }
52
+
53
+ await invokeLegacy(legacyArgs);
54
+ });
55
+ }
@@ -1,10 +1,10 @@
1
- function wantsJsonOutput(commandOptions, command) {
2
- const local = Boolean(commandOptions && commandOptions.json);
3
- const globalFromCommand =
4
- command && command.optsWithGlobals ? Boolean(command.optsWithGlobals().json) : false;
5
- return local || globalFromCommand;
6
- }
7
-
1
+ function wantsJsonOutput(commandOptions, command) {
2
+ const local = Boolean(commandOptions && commandOptions.json);
3
+ const globalFromCommand =
4
+ command && command.optsWithGlobals ? Boolean(command.optsWithGlobals().json) : false;
5
+ return local || globalFromCommand;
6
+ }
7
+
8
8
  function appendPathFlag(args, maybePath) {
9
9
  const value = String(maybePath || "").trim();
10
10
  if (value) {
@@ -18,7 +18,7 @@ function appendOutputDirFlag(args, maybeOutputDir) {
18
18
  args.push("--output-dir", value);
19
19
  }
20
20
  }
21
-
21
+
22
22
  export function buildLegacyArgs(baseArgs, { commandOptions = {}, command } = {}) {
23
23
  const args = [...baseArgs];
24
24
  appendPathFlag(args, commandOptions.path);
@@ -26,5 +26,5 @@ export function buildLegacyArgs(baseArgs, { commandOptions = {}, command } = {})
26
26
  if (wantsJsonOutput(commandOptions, command)) {
27
27
  args.push("--json");
28
28
  }
29
- return args;
30
- }
29
+ return args;
30
+ }