@kici-dev/compiler 0.0.0 → 0.1.1
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/LICENSE +202 -0
- package/README.md +1 -6
- package/dist/assets/api-TJJVHrjC.json +118 -0
- package/dist/assets/descriptor-BTtjzN9L.json +1382 -0
- package/dist/assets/package-BpQF9kR8.json +74 -0
- package/dist/assets/package-Ceo2h27X.json +89 -0
- package/dist/assets/source_context-D0atuL28.json +20 -0
- package/dist/assets/type-BFqO8SCZ.json +202 -0
- package/dist/auth/headless-detect.d.ts +14 -0
- package/dist/auth/headless-detect.js +25 -0
- package/dist/chunk-gOLHoazu.js +4 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +193 -0
- package/dist/commands/cancel.d.ts +22 -0
- package/dist/commands/cancel.js +124 -0
- package/dist/commands/compile.d.ts +17 -0
- package/dist/commands/compile.js +99 -0
- package/dist/commands/docs.d.ts +26 -0
- package/dist/commands/docs.js +60 -0
- package/dist/commands/drain-worker.d.ts +19 -0
- package/dist/commands/drain-worker.js +45 -0
- package/dist/commands/endpoints.d.ts +53 -0
- package/dist/commands/endpoints.js +185 -0
- package/dist/commands/fixture.d.ts +14 -0
- package/dist/commands/fixture.js +104 -0
- package/dist/commands/hook.d.ts +20 -0
- package/dist/commands/hook.js +97 -0
- package/dist/commands/index.d.ts +33 -0
- package/dist/commands/index.js +20 -0
- package/dist/commands/init.d.ts +35 -0
- package/dist/commands/init.js +393 -0
- package/dist/commands/login.d.ts +23 -0
- package/dist/commands/login.js +144 -0
- package/dist/commands/logout.d.ts +18 -0
- package/dist/commands/logout.js +55 -0
- package/dist/commands/org.d.ts +27 -0
- package/dist/commands/org.js +126 -0
- package/dist/commands/run.d.ts +21 -0
- package/dist/commands/run.js +562 -0
- package/dist/commands/secrets-list.d.ts +16 -0
- package/dist/commands/secrets-list.js +85 -0
- package/dist/commands/status.d.ts +30 -0
- package/dist/commands/status.js +210 -0
- package/dist/commands/test.d.ts +61 -0
- package/dist/commands/test.js +220 -0
- package/dist/commands/types.d.ts +18 -0
- package/dist/commands/types.js +74 -0
- package/dist/commands/watch.d.ts +14 -0
- package/dist/commands/watch.js +97 -0
- package/dist/commands/workflows.d.ts +28 -0
- package/dist/commands/workflows.js +154 -0
- package/dist/comment-created.json +30 -0
- package/dist/create-branch.json +17 -0
- package/dist/delete-branch.json +15 -0
- package/dist/dispatch.json +15 -0
- package/dist/errors/capability-gap.d.ts +50 -0
- package/dist/errors/capability-gap.js +54 -0
- package/dist/errors/codes.d.ts +25 -0
- package/dist/errors/formatter.d.ts +32 -0
- package/dist/errors/formatter.js +35 -0
- package/dist/errors/index.d.ts +5 -0
- package/dist/errors/index.js +4 -0
- package/dist/execution/executor.d.ts +61 -0
- package/dist/execution/executor.js +230 -0
- package/dist/execution/index.d.ts +4 -0
- package/dist/execution/index.js +3 -0
- package/dist/execution/sdk-alias.d.ts +33 -0
- package/dist/execution/sdk-alias.js +102 -0
- package/dist/fixtures/compiler.d.ts +47 -0
- package/dist/fixtures/compiler.js +177 -0
- package/dist/fixtures/defaults/comment-created.json +30 -0
- package/dist/fixtures/defaults/create-branch.json +17 -0
- package/dist/fixtures/defaults/delete-branch.json +15 -0
- package/dist/fixtures/defaults/dispatch.json +15 -0
- package/dist/fixtures/defaults/fork.json +19 -0
- package/dist/fixtures/defaults/index.d.ts +16 -0
- package/dist/fixtures/defaults/index.js +105 -0
- package/dist/fixtures/defaults/index.ts +145 -0
- package/dist/fixtures/defaults/pr-closed.json +28 -0
- package/dist/fixtures/defaults/pr-opened.json +27 -0
- package/dist/fixtures/defaults/pr-reopened.json +27 -0
- package/dist/fixtures/defaults/pr-synchronize.json +27 -0
- package/dist/fixtures/defaults/push.json +16 -0
- package/dist/fixtures/defaults/release-published.json +23 -0
- package/dist/fixtures/defaults/review-comment-created.json +36 -0
- package/dist/fixtures/defaults/review-submitted.json +35 -0
- package/dist/fixtures/defaults/star-created.json +15 -0
- package/dist/fixtures/defaults/status.json +26 -0
- package/dist/fixtures/defaults/tag-push.json +20 -0
- package/dist/fixtures/defaults/watch-started.json +15 -0
- package/dist/fixtures/defaults/workflow-run-completed.json +23 -0
- package/dist/fork.json +19 -0
- package/dist/format.d.ts +5 -0
- package/dist/format.js +20 -0
- package/dist/generators/secrets-dts.d.ts +29 -0
- package/dist/generators/secrets-dts.js +67 -0
- package/dist/hooks/detector.d.ts +39 -0
- package/dist/hooks/detector.js +133 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.js +5 -0
- package/dist/hooks/installer.d.ts +24 -0
- package/dist/hooks/installer.js +328 -0
- package/dist/hooks/templates.d.ts +26 -0
- package/dist/hooks/templates.js +63 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/llm-context/llms-full.txt +9974 -0
- package/dist/llm-context/llms.txt +61 -0
- package/dist/local-executor/dag-scheduler.d.ts +44 -0
- package/dist/local-executor/dag-scheduler.js +183 -0
- package/dist/local-executor/index.d.ts +23 -0
- package/dist/local-executor/index.js +309 -0
- package/dist/local-executor/job-runner.d.ts +40 -0
- package/dist/local-executor/job-runner.js +307 -0
- package/dist/local-executor/output-streamer.d.ts +31 -0
- package/dist/local-executor/output-streamer.js +166 -0
- package/dist/local-executor/payload-generator.d.ts +16 -0
- package/dist/local-executor/payload-generator.js +138 -0
- package/dist/local-executor/picker.d.ts +33 -0
- package/dist/local-executor/picker.js +109 -0
- package/dist/local-executor/secret-loader.d.ts +18 -0
- package/dist/local-executor/secret-loader.js +105 -0
- package/dist/local-executor/types.d.ts +80 -0
- package/dist/local-executor/types.js +2 -0
- package/dist/local-executor/workflow-lock.d.ts +81 -0
- package/dist/local-executor/workflow-lock.js +0 -0
- package/dist/lockfile/generator.d.ts +39 -0
- package/dist/lockfile/generator.js +688 -0
- package/dist/lockfile/hash-files.d.ts +14 -0
- package/dist/lockfile/hash-files.js +50 -0
- package/dist/lockfile/hasher.d.ts +36 -0
- package/dist/lockfile/hasher.js +46 -0
- package/dist/lockfile/index.d.ts +3 -0
- package/dist/lockfile/index.js +4 -0
- package/dist/lockfile/purity-analyzer.d.ts +25 -0
- package/dist/lockfile/purity-analyzer.js +204 -0
- package/dist/package-F7UXSDHW.json +74 -0
- package/dist/postinstall.d.ts +9 -0
- package/dist/postinstall.js +60 -0
- package/dist/pr-closed.json +28 -0
- package/dist/pr-opened.json +27 -0
- package/dist/pr-reopened.json +27 -0
- package/dist/pr-synchronize.json +27 -0
- package/dist/push.json +16 -0
- package/dist/release-published.json +23 -0
- package/dist/remote/client.d.ts +204 -0
- package/dist/remote/client.js +203 -0
- package/dist/remote/config.d.ts +54 -0
- package/dist/remote/config.js +92 -0
- package/dist/remote/encryption.d.ts +35 -0
- package/dist/remote/encryption.js +87 -0
- package/dist/remote/history.d.ts +91 -0
- package/dist/remote/history.js +146 -0
- package/dist/remote/oauth.d.ts +65 -0
- package/dist/remote/oauth.js +302 -0
- package/dist/remote/observer.d.ts +81 -0
- package/dist/remote/observer.js +174 -0
- package/dist/remote/output/json.d.ts +13 -0
- package/dist/remote/output/json.js +36 -0
- package/dist/remote/output/junit.d.ts +18 -0
- package/dist/remote/output/junit.js +50 -0
- package/dist/remote/output/streaming.d.ts +57 -0
- package/dist/remote/output/streaming.js +124 -0
- package/dist/remote/output/summary.d.ts +39 -0
- package/dist/remote/output/summary.js +99 -0
- package/dist/remote/uploader.d.ts +87 -0
- package/dist/remote/uploader.js +197 -0
- package/dist/review-comment-created.json +36 -0
- package/dist/review-submitted.json +35 -0
- package/dist/star-created.json +15 -0
- package/dist/status.json +26 -0
- package/dist/tag-push.json +20 -0
- package/dist/templates/agents-md.d.ts +8 -0
- package/dist/templates/agents-md.js +130 -0
- package/dist/templates/index.d.ts +43 -0
- package/dist/templates/index.js +48 -0
- package/dist/templates/package-json.d.ts +18 -0
- package/dist/templates/package-json.js +34 -0
- package/dist/templates/tsconfig-json.d.ts +9 -0
- package/dist/templates/tsconfig-json.js +26 -0
- package/dist/templates/workflows/hello-world.d.ts +2 -0
- package/dist/templates/workflows/hello-world.js +16 -0
- package/dist/templates/workflows/hello-world.ts +21 -0
- package/dist/templates/workflows/pr-checks.d.ts +2 -0
- package/dist/templates/workflows/pr-checks.js +40 -0
- package/dist/templates/workflows/pr-checks.ts +57 -0
- package/dist/test-runner/dry-run.d.ts +12 -0
- package/dist/test-runner/dry-run.js +66 -0
- package/dist/test-runner/event-types.d.ts +86 -0
- package/dist/test-runner/event-types.js +330 -0
- package/dist/test-runner/git-detector.d.ts +15 -0
- package/dist/test-runner/git-detector.js +30 -0
- package/dist/test-runner/index.d.ts +13 -0
- package/dist/test-runner/index.js +11 -0
- package/dist/test-runner/job-executor.d.ts +48 -0
- package/dist/test-runner/job-executor.js +245 -0
- package/dist/test-runner/output-formatter.d.ts +47 -0
- package/dist/test-runner/output-formatter.js +92 -0
- package/dist/test-runner/payload-builder.d.ts +20 -0
- package/dist/test-runner/payload-builder.js +216 -0
- package/dist/test-runner/rule-evaluator.d.ts +14 -0
- package/dist/test-runner/rule-evaluator.js +31 -0
- package/dist/test-runner/secrets-file.d.ts +24 -0
- package/dist/test-runner/secrets-file.js +62 -0
- package/dist/test-runner/step-context.d.ts +15 -0
- package/dist/test-runner/step-context.js +140 -0
- package/dist/test-runner/summary.d.ts +7 -0
- package/dist/types.d.ts +525 -0
- package/dist/types.js +33 -0
- package/dist/validation/index.d.ts +3 -0
- package/dist/validation/index.js +3 -0
- package/dist/validation/validator.d.ts +26 -0
- package/dist/validation/validator.js +164 -0
- package/dist/watch-started.json +15 -0
- package/dist/workflow-run-completed.json +23 -0
- package/dist/workflows/hello-world.ts +21 -0
- package/dist/workflows/pr-checks.ts +57 -0
- package/hack/postinstall.mjs +105 -0
- package/package.json +61 -5
- package/sbom.spdx.json +10997 -0
- package/index.js +0 -3
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import "../chunk-gOLHoazu.js";
|
|
2
|
+
import { loadGlobalConfig, mergeGlobalConfig } from "../remote/config.js";
|
|
3
|
+
import pc from "picocolors";
|
|
4
|
+
//#region src/commands/org.ts
|
|
5
|
+
/**
|
|
6
|
+
* kici org commands
|
|
7
|
+
*
|
|
8
|
+
* Org management: list, use, current.
|
|
9
|
+
* Uses PAT auth to fetch user's organizations from Platform API.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Fetch user's organizations from Platform API using PAT auth.
|
|
13
|
+
*/
|
|
14
|
+
async function fetchUserOrgs(config) {
|
|
15
|
+
const url = `${config.platformEndpoint}/api/v1/user/orgs`;
|
|
16
|
+
const response = await fetch(url, { headers: {
|
|
17
|
+
Authorization: `Bearer ${config.pat}`,
|
|
18
|
+
"Content-Type": "application/json"
|
|
19
|
+
} });
|
|
20
|
+
if (!response.ok) {
|
|
21
|
+
if (response.status === 401) {
|
|
22
|
+
console.error(pc.red("Authentication failed. Your PAT may be expired. Run `kici login` to re-authenticate."));
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
console.error(pc.red(`Failed to fetch organizations: HTTP ${response.status}`));
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
const body = await response.json();
|
|
29
|
+
return Array.isArray(body) ? body : body.orgs;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Check that the user is logged in (PAT exists in config).
|
|
33
|
+
* Returns the config if logged in, null otherwise.
|
|
34
|
+
*/
|
|
35
|
+
async function requireAuth() {
|
|
36
|
+
const config = await loadGlobalConfig();
|
|
37
|
+
if (!config.pat) {
|
|
38
|
+
console.error(pc.red("Not logged in. Run `kici login` first."));
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
if (!config.platformEndpoint) {
|
|
42
|
+
console.error(pc.red("No Platform endpoint configured. Run `kici login` with --platform-endpoint."));
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return config;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* List user's organizations.
|
|
49
|
+
*
|
|
50
|
+
* Fetches orgs from Platform API and displays them as a formatted table.
|
|
51
|
+
* Active org is marked with a star.
|
|
52
|
+
*/
|
|
53
|
+
async function orgListCommand() {
|
|
54
|
+
const config = await requireAuth();
|
|
55
|
+
if (!config) return false;
|
|
56
|
+
const orgs = await fetchUserOrgs(config);
|
|
57
|
+
if (orgs === null) return false;
|
|
58
|
+
if (orgs.length === 0) {
|
|
59
|
+
console.log(pc.gray("No organizations found."));
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
console.log(pc.bold("\nOrganizations:\n"));
|
|
63
|
+
const nameWidth = Math.max(12, ...orgs.map((o) => o.displayName.length)) + 2;
|
|
64
|
+
for (const org of orgs) {
|
|
65
|
+
const isActive = org.id === config.activeOrgId;
|
|
66
|
+
const marker = isActive ? pc.green("* ") : " ";
|
|
67
|
+
const name = isActive ? pc.bold(org.displayName) : org.displayName;
|
|
68
|
+
const role = pc.gray(`(${org.role})`);
|
|
69
|
+
const id = pc.gray(org.id);
|
|
70
|
+
console.log(` ${marker}${name.padEnd(nameWidth)} ${role} ${id}`);
|
|
71
|
+
}
|
|
72
|
+
console.log("");
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Switch active organization.
|
|
77
|
+
*
|
|
78
|
+
* Matches by display name (case-insensitive) or ID.
|
|
79
|
+
* Validates org exists before setting.
|
|
80
|
+
*/
|
|
81
|
+
async function orgUseCommand(nameOrId) {
|
|
82
|
+
const config = await requireAuth();
|
|
83
|
+
if (!config) return false;
|
|
84
|
+
const orgs = await fetchUserOrgs(config);
|
|
85
|
+
if (orgs === null) return false;
|
|
86
|
+
const match = orgs.find((o) => o.displayName.toLowerCase() === nameOrId.toLowerCase() || o.id === nameOrId);
|
|
87
|
+
if (!match) {
|
|
88
|
+
console.error(pc.red(`Organization not found: ${nameOrId}`));
|
|
89
|
+
if (orgs.length > 0) {
|
|
90
|
+
console.error(pc.gray("Available organizations:"));
|
|
91
|
+
for (const org of orgs) console.error(pc.gray(` - ${org.displayName} (${org.id})`));
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
await mergeGlobalConfig({ activeOrgId: match.id });
|
|
96
|
+
console.log(pc.green(`Active org set to: ${match.displayName}`));
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Display current active organization.
|
|
101
|
+
*
|
|
102
|
+
* If PAT is available, fetches org name for display.
|
|
103
|
+
*/
|
|
104
|
+
async function orgCurrentCommand() {
|
|
105
|
+
const config = await loadGlobalConfig();
|
|
106
|
+
if (!config.activeOrgId) {
|
|
107
|
+
console.log(pc.gray("No active org set. Run 'kici org use <name>' to set one."));
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
if (config.pat && config.platformEndpoint) {
|
|
111
|
+
const orgs = await fetchUserOrgs(config);
|
|
112
|
+
if (orgs) {
|
|
113
|
+
const org = orgs.find((o) => o.id === config.activeOrgId);
|
|
114
|
+
if (org) {
|
|
115
|
+
console.log(`Active org: ${pc.bold(org.displayName)} ${pc.gray(`(${org.id})`)}`);
|
|
116
|
+
return true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
console.log(`Active org: ${pc.bold(config.activeOrgId)}`);
|
|
121
|
+
return true;
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
export { orgCurrentCommand, orgListCommand, orgUseCommand };
|
|
125
|
+
|
|
126
|
+
//# sourceMappingURL=org.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { RunLocalOptions } from '../local-executor/types.js';
|
|
2
|
+
import { OrchestratorClient } from '../remote/client.js';
|
|
3
|
+
import type { RemoteRunOptions, RemoteRunResult } from './test.js';
|
|
4
|
+
/**
|
|
5
|
+
* Run a workflow locally using the local executor.
|
|
6
|
+
* Thin wrapper that delegates to executeLocal from local-executor.
|
|
7
|
+
*
|
|
8
|
+
* Exit codes: 0 = success, 1 = job failure, 2 = config/compilation error
|
|
9
|
+
*/
|
|
10
|
+
export declare function runLocalCommand(options: RunLocalOptions): Promise<boolean>;
|
|
11
|
+
/**
|
|
12
|
+
* Run fixtures remotely against the orchestrator.
|
|
13
|
+
* Migrated from test.ts — full remote execution functionality.
|
|
14
|
+
*/
|
|
15
|
+
export declare function runRemoteCommand(fixture: string | undefined, options: RemoteRunOptions): Promise<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* Observe run completion via WebSocket (primary path).
|
|
18
|
+
* Falls back to HTTP polling if the WS connection fails.
|
|
19
|
+
*/
|
|
20
|
+
export declare function observeCompletion(fixtureId: string, runId: string, observeUrl: string, token: string, client: OrchestratorClient, options: RemoteRunOptions): Promise<RemoteRunResult>;
|
|
21
|
+
//# sourceMappingURL=run.d.ts.map
|