@runa-ai/runa-cli 0.10.0 → 0.10.2
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-Y5ANTCKE.js → chunk-EZ46JIEO.js} +5 -2
- package/dist/{chunk-ZWDWFMOX.js → chunk-HWR5NUUZ.js} +24 -3
- package/dist/{chunk-OXQISY3J.js → chunk-IR7SA2ME.js} +1 -1
- package/dist/{chunk-QDOR3GTD.js → chunk-LCJNIHZY.js} +82 -14
- package/dist/{chunk-JQXOVCOP.js → chunk-NIS77243.js} +8 -5
- package/dist/{chunk-URWDB7YL.js → chunk-O3M7A73M.js} +58 -2
- package/dist/{chunk-PAWNJA3N.js → chunk-XFXGFUAM.js} +1 -1
- package/dist/{chunk-IEKYTCYA.js → chunk-YTQS2O4H.js} +59 -0
- package/dist/{ci-FLTJ2UXB.js → ci-6XYG7XNX.js} +5 -5
- package/dist/{cli-THEA6T7N.js → cli-2XL3VESS.js} +14 -14
- package/dist/commands/build/contract.d.ts +2 -2
- package/dist/commands/build/machine.d.ts +6 -6
- package/dist/commands/ci/commands/ci-prod-types.d.ts +1 -1
- package/dist/commands/ci/machine/contract.d.ts +10 -10
- package/dist/commands/ci/machine/machine.d.ts +3 -3
- package/dist/commands/ci/utils/ci-summary.d.ts +3 -3
- package/dist/commands/db/apply/contract.d.ts +1 -1
- package/dist/commands/db/apply/helpers/pg-schema-diff-helpers.d.ts +6 -0
- package/dist/commands/db/apply/helpers/planner-artifact.d.ts +1 -1
- package/dist/commands/db/commands/db-preview-profile.d.ts +1 -1
- package/dist/commands/db/commands/db-sync/production-precheck.d.ts +0 -8
- package/dist/commands/db/preflight/contract.d.ts +1 -1
- package/dist/commands/db/sync/contract.d.ts +5 -5
- package/dist/commands/db/sync/machine.d.ts +2 -2
- package/dist/commands/db/sync/schema-guardrail-graph-guidance.d.ts +18 -1
- package/dist/commands/db/sync/schema-guardrail-graph-metadata.d.ts +1 -7
- package/dist/commands/db/sync/schema-guardrail-graph-nodes.d.ts +1 -1
- package/dist/commands/db/sync/schema-guardrail-graph-sql-helpers.d.ts +1 -1
- package/dist/commands/db/sync/schema-guardrail-types.d.ts +4 -2
- package/dist/commands/db/utils/changed-files-detector.d.ts +21 -0
- package/dist/commands/db/utils/duplicate-function-ownership-allowlist.d.ts +13 -0
- package/dist/commands/db/utils/schema-sync.d.ts +12 -0
- package/dist/commands/db/utils/sql-boundary-parser.d.ts +13 -0
- package/dist/commands/db/utils/sql-file-collector.d.ts +2 -0
- package/dist/commands/upgrade.d.ts +36 -0
- package/dist/constants/versions.d.ts +9 -0
- package/dist/{db-IDKQ44VX.js → db-4AGPISOW.js} +1560 -1006
- package/dist/{dev-LGSMDFJN.js → dev-QR55VDNZ.js} +1 -1
- package/dist/{error-handler-YRQWRDEF.js → error-handler-XUQOP4TU.js} +1 -2
- package/dist/{hotfix-RJIAPLAM.js → hotfix-JYHDY2M6.js} +1 -2
- package/dist/index.js +4 -4
- package/dist/{init-2O6ODG5Z.js → init-4UAWYY75.js} +1 -1
- package/dist/{license-OB7GVJQ2.js → license-M6ODBV4X.js} +140 -154
- package/dist/pg-schema-diff-helpers-JZO4GAQG.js +7 -0
- package/dist/{risk-detector-S7XQF4I2.js → risk-detector-GDDLISVE.js} +1 -1
- package/dist/{risk-detector-core-TGFKWHRS.js → risk-detector-core-YI3M6INI.js} +1 -1
- package/dist/{risk-detector-plpgsql-O32TUR34.js → risk-detector-plpgsql-4GWEQXUG.js} +1 -1
- package/dist/{template-check-VNNQQXCX.js → template-check-D35F2GDP.js} +4 -0
- package/dist/{upgrade-QZKEI3NJ.js → upgrade-X7P6WRD5.js} +190 -20
- package/dist/utils/license/index.d.ts +15 -24
- package/dist/utils/license/types.d.ts +3 -4
- package/dist/utils/template-access.d.ts +20 -0
- package/dist/utils/template-fetcher.d.ts +10 -7
- package/dist/{vuln-check-JRPMUHLF.js → vuln-check-LMDYYJUE.js} +1 -1
- package/dist/{vuln-checker-Q7LSHUHJ.js → vuln-checker-NHXLNZRM.js} +1 -1
- package/dist/{watch-RFVCEQLH.js → watch-4RHXVCQ3.js} +1 -1
- package/package.json +3 -3
- package/dist/chunk-ZZOXM6Q4.js +0 -8
- package/dist/pg-schema-diff-helpers-7377FS2D.js +0 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
|
-
import { fetchTemplates } from './chunk-
|
|
3
|
+
import { fetchTemplates } from './chunk-YTQS2O4H.js';
|
|
4
4
|
import { updateRunaConfigSdkVersion } from './chunk-6AALH2ED.js';
|
|
5
5
|
import './chunk-B7C7CLW2.js';
|
|
6
6
|
import './chunk-RZLYEO4U.js';
|
|
@@ -8,7 +8,9 @@ import { emitJsonSuccess } from './chunk-KE6QJBZG.js';
|
|
|
8
8
|
import './chunk-WJXC4MVY.js';
|
|
9
9
|
import './chunk-HKUWEGUX.js';
|
|
10
10
|
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
11
|
-
import {
|
|
11
|
+
import { existsSync, readdirSync, statSync, readFileSync } from 'fs';
|
|
12
|
+
import { join, extname } from 'path';
|
|
13
|
+
import { createCLILogger, CLIError, loadRunaConfig, UpgradeTransaction, readRunaVersion, syncTemplates, SyncOutputSchema, findConflictFiles, preCheckSync } from '@runa-ai/runa';
|
|
12
14
|
import { Command } from 'commander';
|
|
13
15
|
import { execa } from 'execa';
|
|
14
16
|
|
|
@@ -36,6 +38,154 @@ function parseOnlyOption(only) {
|
|
|
36
38
|
}
|
|
37
39
|
return valid;
|
|
38
40
|
}
|
|
41
|
+
var MERGE_MARKER_PATTERN = /^<{7}\s|^={7}$|^>{7}\s/m;
|
|
42
|
+
var MERGE_MARKER_SCAN_EXTENSIONS = [
|
|
43
|
+
".ts",
|
|
44
|
+
".tsx",
|
|
45
|
+
".js",
|
|
46
|
+
".jsx",
|
|
47
|
+
".md",
|
|
48
|
+
".yml",
|
|
49
|
+
".yaml",
|
|
50
|
+
".json",
|
|
51
|
+
".toml"
|
|
52
|
+
];
|
|
53
|
+
var MERGE_MARKER_SCAN_DIRS = [".claude", ".codex", ".github", "supabase"];
|
|
54
|
+
var MERGE_MARKER_SKIP_DIRS = ["node_modules", ".git", "dist"];
|
|
55
|
+
var MERGE_MARKER_ROOT_FILES = [
|
|
56
|
+
"AGENTS.md",
|
|
57
|
+
"CLAUDE.md",
|
|
58
|
+
"runa.config.ts",
|
|
59
|
+
"biome.json",
|
|
60
|
+
"turbo.json",
|
|
61
|
+
"vercel.json",
|
|
62
|
+
".env.example",
|
|
63
|
+
".npmrc"
|
|
64
|
+
];
|
|
65
|
+
function fileHasMergeMarkers(filePath) {
|
|
66
|
+
try {
|
|
67
|
+
return MERGE_MARKER_PATTERN.test(readFileSync(filePath, "utf-8"));
|
|
68
|
+
} catch {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function shouldScanMergeMarkerEntry(entry) {
|
|
73
|
+
return MERGE_MARKER_SCAN_EXTENSIONS.includes(extname(entry).toLowerCase());
|
|
74
|
+
}
|
|
75
|
+
function scanDirForMergeMarkers(dir, relativePath, results) {
|
|
76
|
+
let entries;
|
|
77
|
+
try {
|
|
78
|
+
entries = readdirSync(dir);
|
|
79
|
+
} catch {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
for (const entry of entries) {
|
|
83
|
+
if (MERGE_MARKER_SKIP_DIRS.includes(entry)) continue;
|
|
84
|
+
const fullPath = join(dir, entry);
|
|
85
|
+
const relPath = join(relativePath, entry);
|
|
86
|
+
try {
|
|
87
|
+
const stats = statSync(fullPath);
|
|
88
|
+
if (stats.isDirectory()) {
|
|
89
|
+
scanDirForMergeMarkers(fullPath, relPath, results);
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (stats.isFile() && shouldScanMergeMarkerEntry(entry) && fileHasMergeMarkers(fullPath)) {
|
|
93
|
+
results.push(relPath);
|
|
94
|
+
}
|
|
95
|
+
} catch {
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function findFilesWithMergeMarkers(targetDir) {
|
|
100
|
+
const filesWithMarkers = [];
|
|
101
|
+
for (const checkDir of MERGE_MARKER_SCAN_DIRS) {
|
|
102
|
+
const dirPath = join(targetDir, checkDir);
|
|
103
|
+
if (existsSync(dirPath)) {
|
|
104
|
+
scanDirForMergeMarkers(dirPath, checkDir, filesWithMarkers);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
for (const file of MERGE_MARKER_ROOT_FILES) {
|
|
108
|
+
const filePath = join(targetDir, file);
|
|
109
|
+
if (existsSync(filePath) && fileHasMergeMarkers(filePath)) {
|
|
110
|
+
filesWithMarkers.push(file);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return filesWithMarkers.sort();
|
|
114
|
+
}
|
|
115
|
+
function assertNoExistingMergeMarkers(targetDir) {
|
|
116
|
+
const filesWithMarkers = findFilesWithMergeMarkers(targetDir);
|
|
117
|
+
if (filesWithMarkers.length === 0) return;
|
|
118
|
+
throw new CLIError(
|
|
119
|
+
`${filesWithMarkers.length} file(s) have unresolved or partial merge markers`,
|
|
120
|
+
"UPGRADE_EXISTING_MERGE_MARKERS",
|
|
121
|
+
[
|
|
122
|
+
`Files: ${filesWithMarkers.slice(0, 5).join(", ")}${filesWithMarkers.length > 5 ? ` and ${filesWithMarkers.length - 5} more` : ""}`,
|
|
123
|
+
"Resolve previous merge markers before running `runa upgrade` again",
|
|
124
|
+
"Then run: runa check"
|
|
125
|
+
]
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
function loadUpgradeConflictResolutionConfig(cwd = process.cwd()) {
|
|
129
|
+
const loaded = loadRunaConfig(cwd);
|
|
130
|
+
const conflictResolution = loaded?.config.upgrade?.conflictResolution;
|
|
131
|
+
return {
|
|
132
|
+
defaultStrategy: conflictResolution?.default ?? "manual",
|
|
133
|
+
rules: conflictResolution?.rules ?? []
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
async function resolveInstalledCliTemplatesVersion(cwd = process.cwd()) {
|
|
137
|
+
const script = `
|
|
138
|
+
const fs = require('node:fs');
|
|
139
|
+
const path = require('node:path');
|
|
140
|
+
const entry = require.resolve('@runa-ai/runa-cli');
|
|
141
|
+
const versionsPath = path.join(path.dirname(entry), 'constants', 'versions.js');
|
|
142
|
+
const content = fs.readFileSync(versionsPath, 'utf-8');
|
|
143
|
+
const match = content.match(/COMPATIBLE_TEMPLATES_VERSION\\s*=\\s*['"]([^'"]+)['"]/);
|
|
144
|
+
if (!match) process.exit(2);
|
|
145
|
+
process.stdout.write(match[1]);
|
|
146
|
+
`;
|
|
147
|
+
try {
|
|
148
|
+
const result = await execa("pnpm", ["exec", "node", "-e", script], {
|
|
149
|
+
cwd,
|
|
150
|
+
stdio: "pipe"
|
|
151
|
+
});
|
|
152
|
+
return result.stdout.trim() || null;
|
|
153
|
+
} catch {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
async function resolveTemplatesVersionForUpgrade(params) {
|
|
158
|
+
if (params.options.templatesVersion) {
|
|
159
|
+
return params.options.templatesVersion;
|
|
160
|
+
}
|
|
161
|
+
if (params.options.preview && params.shouldUpdatePackages) {
|
|
162
|
+
throw new CLIError(
|
|
163
|
+
"Preview cannot determine target template compatibility before package installation",
|
|
164
|
+
"UPGRADE_PREVIEW_TEMPLATE_PARITY_UNKNOWN",
|
|
165
|
+
[
|
|
166
|
+
"Run without --preview to install packages first",
|
|
167
|
+
"Or pass --templates-version <version> explicitly",
|
|
168
|
+
"Or run with --no-packages for template-only preview"
|
|
169
|
+
]
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
const installedVersion = await resolveInstalledCliTemplatesVersion(params.cwd);
|
|
173
|
+
if (installedVersion) {
|
|
174
|
+
return installedVersion;
|
|
175
|
+
}
|
|
176
|
+
if (params.shouldUpdatePackages) {
|
|
177
|
+
throw new CLIError(
|
|
178
|
+
"Could not determine compatible templates version from the installed local CLI",
|
|
179
|
+
"UPGRADE_TEMPLATE_PARITY_UNRESOLVED",
|
|
180
|
+
[
|
|
181
|
+
"Ensure @runa-ai/runa-cli is installed locally",
|
|
182
|
+
"Re-run `runa upgrade` after package installation succeeds",
|
|
183
|
+
"Or pass --templates-version <version> explicitly"
|
|
184
|
+
]
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
return void 0;
|
|
188
|
+
}
|
|
39
189
|
function logVersionInfo(logger, preCheck) {
|
|
40
190
|
if (preCheck.versionJump) {
|
|
41
191
|
const { from, to, isMajor, distance } = preCheck.versionJump;
|
|
@@ -381,12 +531,16 @@ async function getInstalledVersion(packageName) {
|
|
|
381
531
|
return "unknown";
|
|
382
532
|
}
|
|
383
533
|
}
|
|
384
|
-
async function runPreCheck(logger, options, isNonInteractive, templatesDir) {
|
|
534
|
+
async function runPreCheck(logger, options, isNonInteractive, templatesDir, conflictResolution) {
|
|
385
535
|
if (options.force || options.keepLocal) return;
|
|
386
536
|
const preCheck = await preCheckSync({
|
|
387
537
|
targetDir: process.cwd(),
|
|
388
538
|
mode: "sync",
|
|
389
|
-
templatesDir
|
|
539
|
+
templatesDir,
|
|
540
|
+
conflictResolution: {
|
|
541
|
+
defaultStrategy: conflictResolution.defaultStrategy,
|
|
542
|
+
rules: conflictResolution.rules
|
|
543
|
+
}
|
|
390
544
|
});
|
|
391
545
|
logVersionInfo(logger, preCheck);
|
|
392
546
|
logConflictSummary(logger, preCheck, isNonInteractive, options.preview === true);
|
|
@@ -451,9 +605,9 @@ async function executePackageUpdate(logger, options) {
|
|
|
451
605
|
}
|
|
452
606
|
}
|
|
453
607
|
async function executeTemplateSync(ctx, templatesDir) {
|
|
454
|
-
const { logger, options, onlyCategories, isNonInteractive } = ctx;
|
|
608
|
+
const { logger, options, onlyCategories, isNonInteractive, conflictResolution } = ctx;
|
|
455
609
|
logger.section("Upgrade SDK Templates");
|
|
456
|
-
await runPreCheck(logger, options, isNonInteractive, templatesDir);
|
|
610
|
+
await runPreCheck(logger, options, isNonInteractive, templatesDir, conflictResolution);
|
|
457
611
|
logModeInfo(logger, options, onlyCategories);
|
|
458
612
|
const result = await syncTemplates({
|
|
459
613
|
targetDir: process.cwd(),
|
|
@@ -463,7 +617,11 @@ async function executeTemplateSync(ctx, templatesDir) {
|
|
|
463
617
|
keepLocal: options.keepLocal === true,
|
|
464
618
|
keepBackup: options.backup === true,
|
|
465
619
|
only: onlyCategories.length > 0 ? onlyCategories : void 0,
|
|
466
|
-
templatesDir
|
|
620
|
+
templatesDir,
|
|
621
|
+
conflictResolution: {
|
|
622
|
+
defaultStrategy: conflictResolution.defaultStrategy,
|
|
623
|
+
rules: conflictResolution.rules
|
|
624
|
+
}
|
|
467
625
|
});
|
|
468
626
|
emitJsonSuccess(upgradeCommand, SyncOutputSchema, result);
|
|
469
627
|
logHumanOutput(logger, result, options);
|
|
@@ -492,20 +650,28 @@ async function executeVerification(logger) {
|
|
|
492
650
|
}
|
|
493
651
|
}
|
|
494
652
|
async function executeUpgrade(ctx) {
|
|
495
|
-
const { logger, options, shouldUpdatePackages } = ctx;
|
|
496
|
-
|
|
497
|
-
const templateResult = await fetchTemplates({
|
|
498
|
-
version: options.templatesVersion,
|
|
499
|
-
fresh: options.fresh,
|
|
500
|
-
verbose: process.env.DEBUG === "true"
|
|
501
|
-
});
|
|
502
|
-
logger.info(
|
|
503
|
-
templateResult.cached ? `Using ${templateResult.version === "workspace" ? "workspace" : "cached"} templates v${templateResult.version}` : `Fetched templates v${templateResult.version}`
|
|
504
|
-
);
|
|
653
|
+
const { logger, options, shouldUpdatePackages, shouldSyncTemplates } = ctx;
|
|
654
|
+
assertNoExistingMergeMarkers(process.cwd());
|
|
505
655
|
if (shouldUpdatePackages) {
|
|
506
656
|
await executePackageUpdate(logger, options);
|
|
507
657
|
}
|
|
508
|
-
|
|
658
|
+
if (shouldSyncTemplates) {
|
|
659
|
+
const templatesVersion = await resolveTemplatesVersionForUpgrade({
|
|
660
|
+
cwd: process.cwd(),
|
|
661
|
+
options,
|
|
662
|
+
shouldUpdatePackages
|
|
663
|
+
});
|
|
664
|
+
logger.section("Fetching Templates");
|
|
665
|
+
const templateResult = await fetchTemplates({
|
|
666
|
+
version: templatesVersion,
|
|
667
|
+
fresh: options.fresh,
|
|
668
|
+
verbose: process.env.DEBUG === "true"
|
|
669
|
+
});
|
|
670
|
+
logger.info(
|
|
671
|
+
templateResult.cached ? `Using ${templateResult.version === "workspace" ? "workspace" : "cached"} templates v${templateResult.version}` : `Fetched templates v${templateResult.version}`
|
|
672
|
+
);
|
|
673
|
+
await executeTemplateSync(ctx, templateResult.templatesDir);
|
|
674
|
+
}
|
|
509
675
|
if (options.verify && !options.preview) {
|
|
510
676
|
await executeVerification(logger);
|
|
511
677
|
}
|
|
@@ -607,14 +773,18 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SDK packages an
|
|
|
607
773
|
}
|
|
608
774
|
const onlyCategories = parseOnlyOption(options.only);
|
|
609
775
|
const shouldUpdatePackages = options.packages !== false && (onlyCategories.length === 0 || onlyCategories.includes("packages"));
|
|
776
|
+
const shouldSyncTemplates = onlyCategories.length === 0 || onlyCategories.some((category) => category !== "packages");
|
|
610
777
|
const isJsonMode = process.env.RUNA_OUTPUT_FORMAT === "json";
|
|
611
778
|
const isNonInteractive = options.yes || isJsonMode || !process.stdin.isTTY;
|
|
779
|
+
const conflictResolution = loadUpgradeConflictResolutionConfig(process.cwd());
|
|
612
780
|
const ctx = {
|
|
613
781
|
logger,
|
|
614
782
|
options,
|
|
615
783
|
onlyCategories,
|
|
616
784
|
shouldUpdatePackages,
|
|
617
|
-
|
|
785
|
+
shouldSyncTemplates,
|
|
786
|
+
isNonInteractive,
|
|
787
|
+
conflictResolution
|
|
618
788
|
};
|
|
619
789
|
try {
|
|
620
790
|
await executeUpgrade(ctx);
|
|
@@ -634,4 +804,4 @@ var upgradeCommand = new Command("upgrade").description("Upgrade SDK packages an
|
|
|
634
804
|
}
|
|
635
805
|
});
|
|
636
806
|
|
|
637
|
-
export { upgradeCommand };
|
|
807
|
+
export { assertNoExistingMergeMarkers, findFilesWithMergeMarkers, loadUpgradeConflictResolutionConfig, resolveTemplatesVersionForUpgrade, upgradeCommand };
|
|
@@ -1,45 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AI HINT: License Enforcement Module
|
|
3
3
|
*
|
|
4
|
-
* Purpose: CI
|
|
5
|
-
* Pattern:
|
|
4
|
+
* Purpose: CI compatibility guard for runa CLI
|
|
5
|
+
* Pattern: Public CLI/SDK/plugin commands are allowed in CI for any owner
|
|
6
6
|
*
|
|
7
7
|
* Design decisions:
|
|
8
|
-
* - r06-dev: Instant allow, NO
|
|
9
|
-
* - External org:
|
|
10
|
-
* -
|
|
11
|
-
*
|
|
12
|
-
* - API available: Use live response
|
|
13
|
-
* - API error + cached: Use last-known-good (24h window)
|
|
14
|
-
* - API error + no cache: Deny access (new orgs blocked during outage)
|
|
15
|
-
* - Escape hatch: RUNA_SKIP_LICENSE_CHECK=1 bypasses all checks (local only)
|
|
8
|
+
* - r06-dev: Instant allow, NO extra checks, NO log (zero-impact)
|
|
9
|
+
* - External org: Also allowed for normal CLI usage in CI
|
|
10
|
+
* - Owner resolution failures: Do not block CI execution
|
|
11
|
+
* - Escape hatch: RUNA_SKIP_LICENSE_CHECK=1 still bypasses checks in local dev
|
|
16
12
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* - Known orgs protected during outages (last-known-good)
|
|
20
|
-
* - Unknown orgs cannot bypass by causing errors (fail closed)
|
|
13
|
+
* Template access is intentionally NOT handled here.
|
|
14
|
+
* `runa init` / `runa upgrade` remain restricted by private GitHub Packages auth.
|
|
21
15
|
*/
|
|
22
16
|
import type { LicenseCheckResult } from './types.js';
|
|
23
17
|
/**
|
|
24
|
-
* Perform
|
|
18
|
+
* Perform CI compatibility check and return result
|
|
25
19
|
*
|
|
26
|
-
*
|
|
20
|
+
* This no longer blocks external organizations. The result is retained so callers
|
|
21
|
+
* can inspect whether the run happened in local dev, trusted org CI, or general CI.
|
|
27
22
|
*/
|
|
28
23
|
export declare function checkLicense(): Promise<LicenseCheckResult>;
|
|
29
24
|
/**
|
|
30
|
-
* Enforce
|
|
25
|
+
* Enforce CI compatibility check in CI environments
|
|
31
26
|
*
|
|
32
|
-
* Call this at CLI startup
|
|
27
|
+
* Call this at CLI startup so the runtime behavior stays centralized.
|
|
33
28
|
*
|
|
34
29
|
* Behavior:
|
|
35
30
|
* - Local dev: Skip silently
|
|
36
31
|
* - r06-dev: Skip silently (no API, no log)
|
|
37
|
-
* - External org
|
|
38
|
-
* -
|
|
39
|
-
* - API error + last-known-good: Use cached result (24h window)
|
|
40
|
-
* - API error + no cache: Block (fail closed for unknown orgs)
|
|
41
|
-
*
|
|
42
|
-
* @throws CLIError when access is denied
|
|
32
|
+
* - External org: Allow for normal CLI usage in CI
|
|
33
|
+
* - Template commands still rely on private package auth in their own code paths
|
|
43
34
|
*/
|
|
44
35
|
export declare function enforceLicenseInCI(): Promise<void>;
|
|
45
36
|
export type { LicenseCheckResult, OwnerResolutionResult, CIDetectionResult } from './types.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* AI HINT: License Check Type Definitions
|
|
3
3
|
*
|
|
4
|
-
* Purpose: Type definitions for CI access
|
|
5
|
-
* Pattern:
|
|
4
|
+
* Purpose: Type definitions for CI access compatibility checks
|
|
5
|
+
* Pattern: CI is always allowed; reasons document how the decision was made
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
8
|
* Result of CI environment detection
|
|
@@ -38,7 +38,6 @@ export interface LicenseCheckResult {
|
|
|
38
38
|
/**
|
|
39
39
|
* Reasons for license check decisions
|
|
40
40
|
*
|
|
41
|
-
* SECURITY (Issue #542): Fail-closed design - errors result in denial
|
|
42
41
|
*/
|
|
43
|
-
export type LicenseCheckReason = 'not-ci' | 'trusted-org' | '
|
|
42
|
+
export type LicenseCheckReason = 'not-ci' | 'trusted-org' | 'ci-allowed' | 'skip-flag';
|
|
44
43
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI HINT: Template Access Verification
|
|
3
|
+
*
|
|
4
|
+
* Purpose: Ensure template operations are limited to users who can access the
|
|
5
|
+
* private runa source repository.
|
|
6
|
+
*
|
|
7
|
+
* Design:
|
|
8
|
+
* - Access is checked before cached templates are returned
|
|
9
|
+
* - NODE_AUTH_TOKEN and GitHub CLI auth are both accepted proof sources
|
|
10
|
+
* - Normal CLI/SDK/plugin commands are not gated by this module
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Verify the current user can access the private runa source repository.
|
|
14
|
+
*
|
|
15
|
+
* This check is intentionally separate from CI compatibility checks:
|
|
16
|
+
* - Normal CLI/SDK/plugin commands remain public
|
|
17
|
+
* - Template operations stay restricted to authorized users
|
|
18
|
+
*/
|
|
19
|
+
export declare function verifyTemplateRepoAccess(): Promise<void>;
|
|
20
|
+
//# sourceMappingURL=template-access.d.ts.map
|
|
@@ -17,19 +17,22 @@
|
|
|
17
17
|
*
|
|
18
18
|
* Authentication Flow:
|
|
19
19
|
* ┌─────────────────────────────────────────────────────────────────┐
|
|
20
|
-
* │ 1.
|
|
21
|
-
* │ └─
|
|
20
|
+
* │ 1. Verify access to r06-dev/runa │
|
|
21
|
+
* │ └─ Required before workspace/cache/fetch paths │
|
|
22
22
|
* │ │
|
|
23
|
-
* │ 2.
|
|
23
|
+
* │ 2. Check workspace (runa-repo development) │
|
|
24
|
+
* │ └─ Found → Use local packages/runa-templates/ │
|
|
25
|
+
* │ │
|
|
26
|
+
* │ 3. Check cache (~/.cache/runa/templates/{version}/) │
|
|
27
|
+
* │ └─ Hit → Return cached path (no network) │
|
|
28
|
+
* │ │
|
|
29
|
+
* │ 4. Try auto-detect NODE_AUTH_TOKEN │
|
|
24
30
|
* │ ├─ Already set → Continue │
|
|
25
31
|
* │ └─ Not set → Try `gh auth token` command │
|
|
26
32
|
* │ ├─ Success → Set NODE_AUTH_TOKEN and continue │
|
|
27
33
|
* │ └─ Fail → CLIError with setup instructions │
|
|
28
34
|
* │ │
|
|
29
|
-
* │
|
|
30
|
-
* │ └─ Hit → Return cached path (no network) │
|
|
31
|
-
* │ │
|
|
32
|
-
* │ 4. Fetch from GitHub Packages │
|
|
35
|
+
* │ 5. Fetch from GitHub Packages │
|
|
33
36
|
* │ └─ Success → Cache and return path │
|
|
34
37
|
* └─────────────────────────────────────────────────────────────────┘
|
|
35
38
|
*
|
|
@@ -71,7 +71,7 @@ var vulnCheckCommand = new Command("vuln-check").description("Run comprehensive
|
|
|
71
71
|
const logger = createCLILogger("vuln-check");
|
|
72
72
|
const isJsonMode = getOutputFormatFromEnv() === "json" || options.format === "json";
|
|
73
73
|
try {
|
|
74
|
-
const { VulnChecker } = await import('./vuln-checker-
|
|
74
|
+
const { VulnChecker } = await import('./vuln-checker-NHXLNZRM.js');
|
|
75
75
|
const categoryMap = {
|
|
76
76
|
code: ["injection", "auth", "crypto"],
|
|
77
77
|
deps: ["dependency"],
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
|
-
import { CLI_VERSION } from './chunk-
|
|
3
|
+
import { CLI_VERSION } from './chunk-IR7SA2ME.js';
|
|
4
4
|
import { init_esm_shims } from './chunk-VRXHCR5K.js';
|
|
5
5
|
import { glob } from 'glob';
|
|
6
6
|
import { exec } from 'child_process';
|
|
@@ -284,7 +284,7 @@ function validateSqlSchema(content, errors, warnings) {
|
|
|
284
284
|
var riskDetectorLoader = null;
|
|
285
285
|
function loadRiskDetectorModule() {
|
|
286
286
|
if (!riskDetectorLoader) {
|
|
287
|
-
riskDetectorLoader = import('./risk-detector-
|
|
287
|
+
riskDetectorLoader = import('./risk-detector-GDDLISVE.js').then((module) => ({
|
|
288
288
|
detectSchemaRisks: module.detectSchemaRisks
|
|
289
289
|
})).catch((error) => {
|
|
290
290
|
riskDetectorLoader = null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@runa-ai/runa-cli",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "AI-powered DevOps CLI",
|
|
6
6
|
"type": "module",
|
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
"typescript": "5.9.3",
|
|
57
57
|
"xstate": "5.28.0",
|
|
58
58
|
"zod": "4.3.6",
|
|
59
|
-
"@runa-ai/runa": "0.10.0",
|
|
60
|
-
"@runa-ai/runa
|
|
59
|
+
"@runa-ai/runa-xstate-test-plugin": "0.10.0",
|
|
60
|
+
"@runa-ai/runa": "0.10.0"
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=20.0.0"
|
package/dist/chunk-ZZOXM6Q4.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire } from 'module';
|
|
3
|
-
export { PG_SCHEMA_DIFF_APPLY_TIMEOUT_MS, buildIdleConnectionCleanupSql, detectDropTableStatements, detectMissingExtensionType, detectMissingQualifiedFunction, detectPartitionPrivilegeError, executePgSchemaDiffPlan, formatDeclarativeDependencyBoundaryHint, formatExtensionErrorHint, formatPartitionPrivilegeHint, freeConnectionSlotsForPgSchemaDiff, startConnectionCleanupDaemon, stopConnectionCleanupDaemon, verifyDatabaseConnection, verifyPgSchemaDiffBinary } from './chunk-ZWDWFMOX.js';
|
|
4
|
-
import './chunk-A6A7JIRD.js';
|
|
5
|
-
import './chunk-VRXHCR5K.js';
|
|
6
|
-
|
|
7
|
-
createRequire(import.meta.url);
|