@kindgi/cli 0.1.4 → 0.1.5
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/README.md +13 -7
- package/dist/build/bundle.d.ts +11 -3
- package/dist/build/bundle.d.ts.map +1 -1
- package/dist/build/bundle.js +17 -3
- package/dist/build/bundle.js.map +1 -1
- package/dist/build/defaults.d.ts +3 -1
- package/dist/build/defaults.d.ts.map +1 -1
- package/dist/build/defaults.js +44 -1
- package/dist/build/defaults.js.map +1 -1
- package/dist/build/java-image.d.ts +31 -0
- package/dist/build/java-image.d.ts.map +1 -0
- package/dist/build/java-image.js +146 -0
- package/dist/build/java-image.js.map +1 -0
- package/dist/build/pack-root.d.ts +1 -31
- package/dist/build/pack-root.d.ts.map +1 -1
- package/dist/build/pack-root.js +22 -2
- package/dist/build/pack-root.js.map +1 -1
- package/dist/build/runners.d.ts +44 -0
- package/dist/build/runners.d.ts.map +1 -1
- package/dist/build/scala-image.d.ts +21 -0
- package/dist/build/scala-image.d.ts.map +1 -0
- package/dist/build/scala-image.js +150 -0
- package/dist/build/scala-image.js.map +1 -0
- package/dist/cli-pin.d.ts +16 -0
- package/dist/cli-pin.d.ts.map +1 -0
- package/dist/cli-pin.js +66 -0
- package/dist/cli-pin.js.map +1 -0
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +9 -8
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/approvals.d.ts.map +1 -1
- package/dist/commands/approvals.js +30 -4
- package/dist/commands/approvals.js.map +1 -1
- package/dist/commands/artifacts.d.ts.map +1 -1
- package/dist/commands/artifacts.js +100 -37
- package/dist/commands/artifacts.js.map +1 -1
- package/dist/commands/auth.js +2 -2
- package/dist/commands/blocks.d.ts.map +1 -1
- package/dist/commands/blocks.js +5 -4
- package/dist/commands/blocks.js.map +1 -1
- package/dist/commands/build.d.ts +10 -2
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +109 -16
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/capabilities.d.ts.map +1 -1
- package/dist/commands/capabilities.js +37 -10
- package/dist/commands/capabilities.js.map +1 -1
- package/dist/commands/console.d.ts +21 -0
- package/dist/commands/console.d.ts.map +1 -0
- package/dist/commands/console.js +87 -0
- package/dist/commands/console.js.map +1 -0
- package/dist/commands/conversations.d.ts.map +1 -1
- package/dist/commands/conversations.js +13 -2
- package/dist/commands/conversations.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +2 -2
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +11 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +212 -40
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/doctor.d.ts +14 -2
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +356 -20
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/env-scoped.d.ts +44 -0
- package/dist/commands/env-scoped.d.ts.map +1 -0
- package/dist/commands/env-scoped.js +222 -0
- package/dist/commands/env-scoped.js.map +1 -0
- package/dist/commands/env.d.ts.map +1 -1
- package/dist/commands/env.js +85 -123
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/eval-runs.d.ts +9 -0
- package/dist/commands/eval-runs.d.ts.map +1 -1
- package/dist/commands/eval-runs.js +20 -19
- package/dist/commands/eval-runs.js.map +1 -1
- package/dist/commands/eval-suites.d.ts.map +1 -1
- package/dist/commands/eval-suites.js +16 -8
- package/dist/commands/eval-suites.js.map +1 -1
- package/dist/commands/exports.d.ts +3 -0
- package/dist/commands/exports.d.ts.map +1 -0
- package/dist/commands/exports.js +82 -0
- package/dist/commands/exports.js.map +1 -0
- package/dist/commands/feedback.d.ts.map +1 -1
- package/dist/commands/feedback.js +6 -5
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/flows.d.ts.map +1 -1
- package/dist/commands/flows.js +2 -1
- package/dist/commands/flows.js.map +1 -1
- package/dist/commands/gate-policies.d.ts.map +1 -1
- package/dist/commands/gate-policies.js +2 -1
- package/dist/commands/gate-policies.js.map +1 -1
- package/dist/commands/guardrails.d.ts.map +1 -1
- package/dist/commands/guardrails.js +3 -2
- package/dist/commands/guardrails.js.map +1 -1
- package/dist/commands/helpers.js +5 -5
- package/dist/commands/helpers.js.map +1 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +14 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/init.d.ts +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +254 -18
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/judge-classes.d.ts.map +1 -1
- package/dist/commands/judge-classes.js +11 -10
- package/dist/commands/judge-classes.js.map +1 -1
- package/dist/commands/judgments.d.ts.map +1 -1
- package/dist/commands/judgments.js +7 -6
- package/dist/commands/judgments.js.map +1 -1
- package/dist/commands/key.js +4 -4
- package/dist/commands/memory.d.ts.map +1 -1
- package/dist/commands/memory.js +277 -25
- package/dist/commands/memory.js.map +1 -1
- package/dist/commands/people.d.ts +3 -0
- package/dist/commands/people.d.ts.map +1 -0
- package/dist/commands/people.js +166 -0
- package/dist/commands/people.js.map +1 -0
- package/dist/commands/proposals.d.ts.map +1 -1
- package/dist/commands/proposals.js +390 -69
- package/dist/commands/proposals.js.map +1 -1
- package/dist/commands/provenance.d.ts.map +1 -1
- package/dist/commands/provenance.js +6 -7
- package/dist/commands/provenance.js.map +1 -1
- package/dist/commands/providers.d.ts.map +1 -1
- package/dist/commands/providers.js +7 -5
- package/dist/commands/providers.js.map +1 -1
- package/dist/commands/reviewers.d.ts.map +1 -1
- package/dist/commands/reviewers.js +3 -2
- package/dist/commands/reviewers.js.map +1 -1
- package/dist/commands/runs.d.ts.map +1 -1
- package/dist/commands/runs.js +35 -15
- package/dist/commands/runs.js.map +1 -1
- package/dist/commands/schedules.d.ts +3 -0
- package/dist/commands/schedules.d.ts.map +1 -0
- package/dist/commands/schedules.js +275 -0
- package/dist/commands/schedules.js.map +1 -0
- package/dist/commands/secrets.d.ts.map +1 -1
- package/dist/commands/secrets.js +10 -11
- package/dist/commands/secrets.js.map +1 -1
- package/dist/commands/service-accounts.d.ts +3 -0
- package/dist/commands/service-accounts.d.ts.map +1 -0
- package/dist/commands/service-accounts.js +175 -0
- package/dist/commands/service-accounts.js.map +1 -0
- package/dist/commands/skills.d.ts +1 -1
- package/dist/commands/skills.d.ts.map +1 -1
- package/dist/commands/skills.js +11 -4
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/sso.d.ts +6 -0
- package/dist/commands/sso.d.ts.map +1 -0
- package/dist/commands/sso.js +318 -0
- package/dist/commands/sso.js.map +1 -0
- package/dist/commands/tokens.d.ts +11 -0
- package/dist/commands/tokens.d.ts.map +1 -1
- package/dist/commands/tokens.js +144 -11
- package/dist/commands/tokens.js.map +1 -1
- package/dist/commands/tools.d.ts.map +1 -1
- package/dist/commands/tools.js +4 -3
- package/dist/commands/tools.js.map +1 -1
- package/dist/commands/unwired.d.ts.map +1 -1
- package/dist/commands/unwired.js +1 -30
- package/dist/commands/unwired.js.map +1 -1
- package/dist/commands/upgrade.d.ts +11 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +160 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/context.d.ts +7 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -0
- package/dist/context.js.map +1 -1
- package/dist/dev/defaults.d.ts +28 -11
- package/dist/dev/defaults.d.ts.map +1 -1
- package/dist/dev/defaults.js +114 -35
- package/dist/dev/defaults.js.map +1 -1
- package/dist/dev/google-credentials.d.ts +50 -0
- package/dist/dev/google-credentials.d.ts.map +1 -0
- package/dist/dev/google-credentials.js +157 -0
- package/dist/dev/google-credentials.js.map +1 -0
- package/dist/dev/java-builder.d.ts +56 -0
- package/dist/dev/java-builder.d.ts.map +1 -0
- package/dist/dev/java-builder.js +204 -0
- package/dist/dev/java-builder.js.map +1 -0
- package/dist/dev/jvm-run-files.d.ts +29 -0
- package/dist/dev/jvm-run-files.d.ts.map +1 -0
- package/dist/dev/jvm-run-files.js +94 -0
- package/dist/dev/jvm-run-files.js.map +1 -0
- package/dist/dev/lines.d.ts +13 -0
- package/dist/dev/lines.d.ts.map +1 -0
- package/dist/dev/lines.js +24 -0
- package/dist/dev/lines.js.map +1 -0
- package/dist/dev/log-view.d.ts +116 -0
- package/dist/dev/log-view.d.ts.map +1 -0
- package/dist/dev/log-view.js +233 -0
- package/dist/dev/log-view.js.map +1 -0
- package/dist/dev/pack-code.d.ts +79 -4
- package/dist/dev/pack-code.d.ts.map +1 -1
- package/dist/dev/pack-code.js +262 -3
- package/dist/dev/pack-code.js.map +1 -1
- package/dist/dev/pack-env.d.ts.map +1 -1
- package/dist/dev/pack-env.js +4 -0
- package/dist/dev/pack-env.js.map +1 -1
- package/dist/dev/pack-service.d.ts +11 -1
- package/dist/dev/pack-service.d.ts.map +1 -1
- package/dist/dev/pack-service.js +56 -20
- package/dist/dev/pack-service.js.map +1 -1
- package/dist/dev/paths.d.ts +6 -0
- package/dist/dev/paths.d.ts.map +1 -1
- package/dist/dev/paths.js +8 -0
- package/dist/dev/paths.js.map +1 -1
- package/dist/dev/project-database.js +1 -1
- package/dist/dev/project-database.js.map +1 -1
- package/dist/dev/runners.d.ts +35 -9
- package/dist/dev/runners.d.ts.map +1 -1
- package/dist/dev/runtime-container.d.ts +10 -2
- package/dist/dev/runtime-container.d.ts.map +1 -1
- package/dist/dev/runtime-container.js +48 -20
- package/dist/dev/runtime-container.js.map +1 -1
- package/dist/dev/runtime-env.d.ts +10 -0
- package/dist/dev/runtime-env.d.ts.map +1 -1
- package/dist/dev/runtime-env.js +8 -4
- package/dist/dev/runtime-env.js.map +1 -1
- package/dist/dev/runtime-image.d.ts +1 -1
- package/dist/dev/runtime-image.js +1 -1
- package/dist/dev/scala-builder.d.ts +72 -0
- package/dist/dev/scala-builder.d.ts.map +1 -0
- package/dist/dev/scala-builder.js +347 -0
- package/dist/dev/scala-builder.js.map +1 -0
- package/dist/env/project-env.d.ts.map +1 -1
- package/dist/env/project-env.js +3 -1
- package/dist/env/project-env.js.map +1 -1
- package/dist/errors.d.ts +9 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +15 -0
- package/dist/errors.js.map +1 -1
- package/dist/init/augment-scaffolder.js +1 -1
- package/dist/init/augment-scaffolder.js.map +1 -1
- package/dist/init/dependency-specs.d.ts +26 -0
- package/dist/init/dependency-specs.d.ts.map +1 -1
- package/dist/init/dependency-specs.js +38 -0
- package/dist/init/dependency-specs.js.map +1 -1
- package/dist/init/java-augment.d.ts +24 -0
- package/dist/init/java-augment.d.ts.map +1 -0
- package/dist/init/java-augment.js +198 -0
- package/dist/init/java-augment.js.map +1 -0
- package/dist/init/mode-detect.d.ts +2 -2
- package/dist/init/mode-detect.d.ts.map +1 -1
- package/dist/init/mode-detect.js +12 -1
- package/dist/init/mode-detect.js.map +1 -1
- package/dist/init/python-augment.js +1 -1
- package/dist/init/python-augment.js.map +1 -1
- package/dist/init/scala-augment.d.ts +23 -0
- package/dist/init/scala-augment.d.ts.map +1 -0
- package/dist/init/scala-augment.js +213 -0
- package/dist/init/scala-augment.js.map +1 -0
- package/dist/init/template-files.d.ts +40 -2
- package/dist/init/template-files.d.ts.map +1 -1
- package/dist/init/template-files.js +56 -5
- package/dist/init/template-files.js.map +1 -1
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +20 -2
- package/dist/main.js.map +1 -1
- package/dist/open-url.d.ts +15 -0
- package/dist/open-url.d.ts.map +1 -0
- package/dist/open-url.js +41 -0
- package/dist/open-url.js.map +1 -0
- package/dist/package-manager.d.ts +10 -3
- package/dist/package-manager.d.ts.map +1 -1
- package/dist/package-manager.js +19 -1
- package/dist/package-manager.js.map +1 -1
- package/dist/providers/presets/anthropic.json +11 -3
- package/dist/sdk-skills/kindgi-authoring-agents/SKILL.md +30 -2
- package/dist/sdk-skills/kindgi-authoring-flows/SKILL.md +1 -1
- package/dist/sdk-skills/kindgi-authoring-guardrails/SKILL.md +47 -3
- package/dist/sdk-skills/kindgi-authoring-mcp-servers/SKILL.md +7 -5
- package/dist/sdk-skills/kindgi-authoring-providers/SKILL.md +40 -15
- package/dist/sdk-skills/kindgi-authoring-tools/SKILL.md +66 -2
- package/dist/sdk-skills/kindgi-framework-feedback/SKILL.md +5 -4
- package/dist/sdk-skills/kindgi-getting-started/SKILL.md +1 -1
- package/dist/sdk-skills/kindgi-java-authoring-agents/SKILL.md +220 -0
- package/dist/sdk-skills/kindgi-java-authoring-flows/SKILL.md +390 -0
- package/dist/sdk-skills/kindgi-java-authoring-guardrails/SKILL.md +209 -0
- package/dist/sdk-skills/kindgi-java-authoring-tools/SKILL.md +334 -0
- package/dist/sdk-skills/kindgi-java-getting-started/SKILL.md +270 -0
- package/dist/sdk-skills/kindgi-python-authoring-agents/SKILL.md +25 -3
- package/dist/sdk-skills/kindgi-python-authoring-flows/SKILL.md +1 -1
- package/dist/sdk-skills/kindgi-python-authoring-guardrails/SKILL.md +10 -3
- package/dist/sdk-skills/kindgi-python-authoring-tools/SKILL.md +45 -6
- package/dist/sdk-skills/kindgi-python-getting-started/SKILL.md +2 -2
- package/dist/sdk-skills/kindgi-scala-authoring-agents/SKILL.md +217 -0
- package/dist/sdk-skills/kindgi-scala-authoring-flows/SKILL.md +357 -0
- package/dist/sdk-skills/kindgi-scala-authoring-guardrails/SKILL.md +199 -0
- package/dist/sdk-skills/kindgi-scala-authoring-tools/SKILL.md +302 -0
- package/dist/sdk-skills/kindgi-scala-getting-started/SKILL.md +302 -0
- package/dist/templates/java/.mvn/wrapper/maven-wrapper.properties +3 -0
- package/dist/templates/java/AGENTS.md +31 -0
- package/dist/templates/java/README.md.tmpl +69 -0
- package/dist/templates/java/gitignore +9 -0
- package/dist/templates/java/kindgi.config.json.tmpl +8 -0
- package/dist/templates/java/kindgiw +33 -0
- package/dist/templates/java/kindgiw.cmd +28 -0
- package/dist/templates/java/mvnw +295 -0
- package/dist/templates/java/pom.xml.tmpl +65 -0
- package/dist/templates/java/src/main/java/__PACKAGE__/agents/EchoAgent.java.tmpl +27 -0
- package/dist/templates/java/src/main/java/__PACKAGE__/flows/EchoFlow.java.tmpl +18 -0
- package/dist/templates/java/src/main/java/__PACKAGE__/guardrails/ResponseNotEmpty.java.tmpl +28 -0
- package/dist/templates/java/src/main/java/__PACKAGE__/tools/Echo.java.tmpl +22 -0
- package/dist/templates/java/src/main/java/__PACKAGE__/tools/Greet.java.tmpl +23 -0
- package/dist/templates/java/src/test/java/__PACKAGE__/ToolsTest.java.tmpl +30 -0
- package/dist/templates/minimal/README.md.tmpl +6 -12
- package/dist/templates/python/README.md.tmpl +4 -4
- package/dist/templates/sample/README.md.tmpl +5 -11
- package/dist/templates/scala/AGENTS.md +32 -0
- package/dist/templates/scala/README.md.tmpl +75 -0
- package/dist/templates/scala/build.sbt.tmpl +16 -0
- package/dist/templates/scala/gitignore +13 -0
- package/dist/templates/scala/kindgi.config.json.tmpl +8 -0
- package/dist/templates/scala/project/build.properties +1 -0
- package/dist/templates/scala/src/main/scala/__PACKAGE__/agents/EchoAgent.scala.tmpl +23 -0
- package/dist/templates/scala/src/main/scala/__PACKAGE__/flows/EchoFlow.scala.tmpl +16 -0
- package/dist/templates/scala/src/main/scala/__PACKAGE__/guardrails/ResponseNotEmpty.scala.tmpl +21 -0
- package/dist/templates/scala/src/main/scala/__PACKAGE__/tools/Echo.scala.tmpl +16 -0
- package/dist/templates/scala/src/main/scala/__PACKAGE__/tools/Greet.scala.tmpl +17 -0
- package/dist/templates/scala/src/test/scala/__PACKAGE__/ToolsSuite.scala.tmpl +23 -0
- package/package.json +13 -12
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
import { UsageError } from '../errors.js';
|
|
3
4
|
import { integerFlag, requiredPositional, runSdk, stringFlag } from './helpers.js';
|
|
4
5
|
const STATUSES = [
|
|
5
6
|
'pending',
|
|
@@ -14,7 +15,7 @@ const STATUSES = [
|
|
|
14
15
|
const DECISIONS = ['approve', 'reject', 'escalate', 'withdraw'];
|
|
15
16
|
function oneOf(flag, value, allowed) {
|
|
16
17
|
if (!allowed.includes(value)) {
|
|
17
|
-
throw new
|
|
18
|
+
throw new UsageError(`--${flag} must be one of ${allowed.join(', ')}, got "${value}"`);
|
|
18
19
|
}
|
|
19
20
|
return value;
|
|
20
21
|
}
|
|
@@ -74,7 +75,7 @@ const complete = {
|
|
|
74
75
|
const id = requiredPositional(ctx, 0, 'approval-id');
|
|
75
76
|
const decision = stringFlag(ctx, 'decision');
|
|
76
77
|
if (decision === undefined) {
|
|
77
|
-
throw new
|
|
78
|
+
throw new UsageError(`--decision=${DECISIONS.join('|')} is required`);
|
|
78
79
|
}
|
|
79
80
|
const rationale = stringFlag(ctx, 'rationale');
|
|
80
81
|
return await ctx.client().approvals.decide(id, {
|
|
@@ -83,10 +84,35 @@ const complete = {
|
|
|
83
84
|
});
|
|
84
85
|
}),
|
|
85
86
|
};
|
|
87
|
+
const exportCmd = {
|
|
88
|
+
kind: 'leaf',
|
|
89
|
+
name: 'export',
|
|
90
|
+
description: "Export a decided approval's audit bundle, signed with the deployment's export key: who decided, when, why, and its evidence. Check it with kindgi exports verify.",
|
|
91
|
+
usage: 'kindgi approvals export <approval-id> [--signing-key=<key-id>] [--include-messages] > bundle.json',
|
|
92
|
+
optionSpec: {
|
|
93
|
+
'signing-key': {
|
|
94
|
+
type: 'string',
|
|
95
|
+
description: "Sign with this key (one the runtime lists). Default: the deployment's active key.",
|
|
96
|
+
},
|
|
97
|
+
'include-messages': {
|
|
98
|
+
type: 'boolean',
|
|
99
|
+
description: "Add the conversation messages of the approval's run.",
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
run: (ctx) => runSdk(ctx, 'approvals export', async () => {
|
|
103
|
+
const id = requiredPositional(ctx, 0, 'approval-id');
|
|
104
|
+
const signingKeyId = stringFlag(ctx, 'signing-key');
|
|
105
|
+
return await ctx.client().approvals.audit.export({
|
|
106
|
+
approvalId: id,
|
|
107
|
+
...(signingKeyId !== undefined && { signingKeyId }),
|
|
108
|
+
...(ctx.options['include-messages'] === true && { includeMessages: true }),
|
|
109
|
+
});
|
|
110
|
+
}),
|
|
111
|
+
};
|
|
86
112
|
export const approvalsCommand = {
|
|
87
113
|
kind: 'group',
|
|
88
114
|
name: 'approvals',
|
|
89
|
-
description: 'Review HITL approvals.',
|
|
90
|
-
subcommands: [list, get, complete],
|
|
115
|
+
description: 'Review HITL approvals, and export their signed audit bundles.',
|
|
116
|
+
subcommands: [list, get, complete, exportCmd],
|
|
91
117
|
};
|
|
92
118
|
//# sourceMappingURL=approvals.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approvals.js","sourceRoot":"","sources":["../../src/commands/approvals.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAKjC,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAGnF,MAAM,QAAQ,GAA8B;IAC1C,SAAS;IACT,UAAU;IACV,WAAW;IACX,UAAU;IACV,UAAU;IACV,WAAW;IACX,SAAS;IACT,WAAW;CACZ,CAAC;AACF,MAAM,SAAS,GAAgC,CAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;AAE7F,SAAS,KAAK,CAAmB,IAAY,EAAE,KAAa,EAAE,OAAqB;IACjF,IAAI,CAAE,OAA6B,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"approvals.js","sourceRoot":"","sources":["../../src/commands/approvals.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAKjC,OAAO,EAAE,UAAU,EAAE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QACnE,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;QACpD,OAAO,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC;YAC/C,UAAU,EAAE,EAAE;YACd,GAAG,CAAC,YAAY,KAAK,SAAS,IAAI,EAAE,YAAY,EAAE,CAAC;YACnD,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,IAAI,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;SAC3E,CAAC,CAAC;IACL,CAAC,CAAC;CACL,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAY;IACvC,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,+DAA+D;IAC5E,WAAW,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,SAAS,CAAC;CAC9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../src/commands/artifacts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"artifacts.d.ts","sourceRoot":"","sources":["../../src/commands/artifacts.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,OAAO,EAAe,MAAM,YAAY,CAAC;AA0KvD,eAAO,MAAM,gBAAgB,EAAE,OAK9B,CAAC"}
|
|
@@ -1,12 +1,39 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
-
import {
|
|
3
|
+
import { createWriteStream } from 'node:fs';
|
|
4
|
+
import { access, readFile } from 'node:fs/promises';
|
|
5
|
+
import { basename, resolve } from 'node:path';
|
|
6
|
+
import { Readable } from 'node:stream';
|
|
7
|
+
import { pipeline } from 'node:stream/promises';
|
|
8
|
+
import { UsageError } from '../errors.js';
|
|
9
|
+
import { integerFlag, listFlag, requiredPositional, runSdk, stringFlag, } from './helpers.js';
|
|
10
|
+
/**
|
|
11
|
+
* `kindgi artifacts`: files runs and people keep in the runtime. Every
|
|
12
|
+
* artifact belongs to a project (its run's, else `--project`, else the
|
|
13
|
+
* tenant's default): reading needs `read` there, uploading and deleting
|
|
14
|
+
* `write`.
|
|
15
|
+
*/
|
|
16
|
+
const TABLE = {
|
|
17
|
+
rows: (page) => page.data,
|
|
18
|
+
columns: [
|
|
19
|
+
{ header: 'ID', get: (m) => String(m.blobId) },
|
|
20
|
+
{ header: 'NAME', get: (m) => m.name },
|
|
21
|
+
{ header: 'TYPE', get: (m) => m.contentType },
|
|
22
|
+
{ header: 'SIZE', get: (m) => String(m.size) },
|
|
23
|
+
{ header: 'PROJECT', get: (m) => m.projectId ?? '' },
|
|
24
|
+
{ header: 'RUN', get: (m) => (m.ownerRunId !== undefined ? String(m.ownerRunId) : '') },
|
|
25
|
+
{ header: 'CREATED', get: (m) => String(m.createdAt) },
|
|
26
|
+
],
|
|
27
|
+
};
|
|
4
28
|
const list = {
|
|
5
29
|
kind: 'leaf',
|
|
6
30
|
name: 'list',
|
|
7
|
-
description: 'List artifacts.',
|
|
8
|
-
usage: 'kindgi artifacts list [--limit=<n>] [--cursor=<c>]',
|
|
31
|
+
description: 'List artifacts you can read, newest first: by run, project or type.',
|
|
32
|
+
usage: 'kindgi artifacts list [--run=<run-id>] [--project=<project-id>] [--content-type=<mime>] [--limit=<n>] [--cursor=<c>] [--table]',
|
|
9
33
|
optionSpec: {
|
|
34
|
+
run: { type: 'string', description: 'Only the artifacts this run produced.' },
|
|
35
|
+
project: { type: 'string', description: "Only one project's artifacts." },
|
|
36
|
+
'content-type': { type: 'string', description: 'Only this MIME type.' },
|
|
10
37
|
limit: {
|
|
11
38
|
type: 'string',
|
|
12
39
|
description: 'The most artifacts to return (default 25, at most 100).',
|
|
@@ -16,72 +43,108 @@ const list = {
|
|
|
16
43
|
description: "Resume after this cursor, from the previous page's `nextCursor`.",
|
|
17
44
|
},
|
|
18
45
|
},
|
|
19
|
-
run: (ctx) => runSdk(ctx, 'artifacts list', async () =>
|
|
46
|
+
run: (ctx) => runSdk(ctx, 'artifacts list', async () => {
|
|
47
|
+
const run = stringFlag(ctx, 'run');
|
|
48
|
+
const project = stringFlag(ctx, 'project');
|
|
49
|
+
const contentType = stringFlag(ctx, 'content-type');
|
|
50
|
+
const limit = integerFlag(ctx, 'limit');
|
|
51
|
+
const cursor = stringFlag(ctx, 'cursor');
|
|
52
|
+
return await ctx.client().artifacts.list({
|
|
53
|
+
...(run !== undefined && { ownerRunId: run }),
|
|
54
|
+
...(project !== undefined && { projectId: project }),
|
|
55
|
+
...(contentType !== undefined && { contentType }),
|
|
56
|
+
...(limit !== undefined && { limit }),
|
|
57
|
+
...(cursor !== undefined && { cursor: cursor }),
|
|
58
|
+
});
|
|
59
|
+
}, TABLE),
|
|
20
60
|
};
|
|
21
61
|
const get = {
|
|
22
62
|
kind: 'leaf',
|
|
23
63
|
name: 'get',
|
|
24
|
-
description:
|
|
64
|
+
description: "An artifact's name, type, size and sha256, without its bytes.",
|
|
25
65
|
usage: 'kindgi artifacts get <blob-id>',
|
|
26
|
-
run: (ctx) => runSdk(ctx, 'artifacts get', async () =>
|
|
27
|
-
requiredPositional(ctx, 0, 'blob-id');
|
|
28
|
-
throwUnwired('artifacts.get');
|
|
29
|
-
}),
|
|
30
|
-
};
|
|
31
|
-
const head = {
|
|
32
|
-
kind: 'leaf',
|
|
33
|
-
name: 'head',
|
|
34
|
-
description: 'HEAD an artifact (metadata only).',
|
|
35
|
-
usage: 'kindgi artifacts head <blob-id>',
|
|
36
|
-
run: (ctx) => runSdk(ctx, 'artifacts head', async () => {
|
|
37
|
-
requiredPositional(ctx, 0, 'blob-id');
|
|
38
|
-
throwUnwired('artifacts.head');
|
|
39
|
-
}),
|
|
66
|
+
run: (ctx) => runSdk(ctx, 'artifacts get', async () => ctx.client().artifacts.head(requiredPositional(ctx, 0, 'blob-id'))),
|
|
40
67
|
};
|
|
68
|
+
/** `--tag=key=value`, repeatable. */
|
|
69
|
+
function tagsFlag(ctx) {
|
|
70
|
+
const raw = listFlag(ctx, 'tag');
|
|
71
|
+
if (raw.length === 0)
|
|
72
|
+
return undefined;
|
|
73
|
+
const tags = {};
|
|
74
|
+
for (const t of raw) {
|
|
75
|
+
const eq = t.indexOf('=');
|
|
76
|
+
if (eq <= 0)
|
|
77
|
+
throw new UsageError(`--tag must be key=value, got "${t}"`);
|
|
78
|
+
tags[t.slice(0, eq)] = t.slice(eq + 1);
|
|
79
|
+
}
|
|
80
|
+
return tags;
|
|
81
|
+
}
|
|
41
82
|
const upload = {
|
|
42
83
|
kind: 'leaf',
|
|
43
84
|
name: 'upload',
|
|
44
|
-
description:
|
|
45
|
-
usage: 'kindgi artifacts upload <file> [--content-type=<mime>]',
|
|
85
|
+
description: "Upload a file as an artifact: it belongs to its run's project, else --project's, else the tenant's default. The runtime caps an upload (100 MB unless set otherwise).",
|
|
86
|
+
usage: 'kindgi artifacts upload <file> [--name=<name>] [--content-type=<mime>] [--run=<run-id>] [--project=<project-id>] [--tag=<key>=<value>]…',
|
|
46
87
|
optionSpec: {
|
|
88
|
+
name: { type: 'string', description: "Its name (default: the file's name)." },
|
|
47
89
|
'content-type': {
|
|
48
90
|
type: 'string',
|
|
49
|
-
description: '
|
|
91
|
+
description: 'Its MIME type, such as `application/pdf` (default: `application/octet-stream`).',
|
|
50
92
|
},
|
|
93
|
+
run: { type: 'string', description: "The run that produced it: it joins that run's project." },
|
|
94
|
+
project: { type: 'string', description: 'With no --run: the project it belongs to.' },
|
|
95
|
+
tag: { type: 'string', multiple: true, description: 'A label, `key=value` (repeatable).' },
|
|
51
96
|
},
|
|
52
97
|
run: (ctx) => runSdk(ctx, 'artifacts upload', async () => {
|
|
53
|
-
requiredPositional(ctx, 0, 'file');
|
|
54
|
-
|
|
98
|
+
const file = requiredPositional(ctx, 0, 'file');
|
|
99
|
+
const body = await readFile(resolve(ctx.cwd, file));
|
|
100
|
+
const name = stringFlag(ctx, 'name') ?? basename(file);
|
|
101
|
+
const contentType = stringFlag(ctx, 'content-type');
|
|
102
|
+
const run = stringFlag(ctx, 'run');
|
|
103
|
+
const project = stringFlag(ctx, 'project');
|
|
104
|
+
const tags = tagsFlag(ctx);
|
|
105
|
+
return await ctx.client().artifacts.upload({
|
|
106
|
+
body: new Uint8Array(body),
|
|
107
|
+
name,
|
|
108
|
+
...(contentType !== undefined && { contentType }),
|
|
109
|
+
...(run !== undefined && { ownerRunId: run }),
|
|
110
|
+
...(project !== undefined && { projectId: project }),
|
|
111
|
+
...(tags !== undefined && { tags }),
|
|
112
|
+
});
|
|
55
113
|
}),
|
|
56
114
|
};
|
|
115
|
+
const exists = (path) => access(path).then(() => true, () => false);
|
|
57
116
|
const download = {
|
|
58
117
|
kind: 'leaf',
|
|
59
118
|
name: 'download',
|
|
60
|
-
description:
|
|
61
|
-
usage: 'kindgi artifacts download <blob-id> [-o <file>]',
|
|
119
|
+
description: "Download an artifact to a file: -o's path, else its own name in this directory (an existing file is kept unless --force).",
|
|
120
|
+
usage: 'kindgi artifacts download <blob-id> [-o <file>] [--force]',
|
|
62
121
|
optionSpec: {
|
|
63
|
-
o: { type: 'string', description: 'Write
|
|
122
|
+
o: { type: 'string', description: 'Write it to this file.' },
|
|
123
|
+
force: { type: 'boolean', description: 'Overwrite the file if it exists.' },
|
|
64
124
|
},
|
|
65
125
|
run: (ctx) => runSdk(ctx, 'artifacts download', async () => {
|
|
66
|
-
requiredPositional(ctx, 0, 'blob-id');
|
|
67
|
-
|
|
68
|
-
|
|
126
|
+
const blobId = requiredPositional(ctx, 0, 'blob-id');
|
|
127
|
+
const got = await ctx.client().artifacts.download(blobId);
|
|
128
|
+
const target = resolve(ctx.cwd, stringFlag(ctx, 'o') ?? basename(got.name || blobId));
|
|
129
|
+
if (ctx.options.force !== true && (await exists(target))) {
|
|
130
|
+
await got.body.cancel();
|
|
131
|
+
throw new Error(`${target} exists: pass --force to overwrite it, or -o <file>`);
|
|
132
|
+
}
|
|
133
|
+
await pipeline(Readable.fromWeb(got.body), createWriteStream(target));
|
|
134
|
+
return { blobId, file: target, size: got.size, hash: got.hash };
|
|
69
135
|
}),
|
|
70
136
|
};
|
|
71
137
|
const del = {
|
|
72
138
|
kind: 'leaf',
|
|
73
139
|
name: 'delete',
|
|
74
|
-
description: 'Delete an artifact.',
|
|
140
|
+
description: 'Delete an artifact. It stays recoverable until the retention policy for `artifact` purges it.',
|
|
75
141
|
usage: 'kindgi artifacts delete <blob-id>',
|
|
76
|
-
run: (ctx) => runSdk(ctx, 'artifacts delete', async () =>
|
|
77
|
-
requiredPositional(ctx, 0, 'blob-id');
|
|
78
|
-
throwUnwired('artifacts.delete');
|
|
79
|
-
}),
|
|
142
|
+
run: (ctx) => runSdk(ctx, 'artifacts delete', async () => ctx.client().artifacts.delete(requiredPositional(ctx, 0, 'blob-id'))),
|
|
80
143
|
};
|
|
81
144
|
export const artifactsCommand = {
|
|
82
145
|
kind: 'group',
|
|
83
146
|
name: 'artifacts',
|
|
84
|
-
description: '
|
|
85
|
-
subcommands: [list, get,
|
|
147
|
+
description: 'Files kept in the runtime, each in a project: list, get, upload, download, delete.',
|
|
148
|
+
subcommands: [list, get, upload, download, del],
|
|
86
149
|
};
|
|
87
150
|
//# sourceMappingURL=artifacts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../src/commands/artifacts.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"artifacts.js","sourceRoot":"","sources":["../../src/commands/artifacts.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,C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M,EAAE,QAAQ,EAAE,GAAG,CAAC;CAChD,CAAC"}
|
package/dist/commands/auth.js
CHANGED
|
@@ -19,14 +19,14 @@ const login = {
|
|
|
19
19
|
return {
|
|
20
20
|
kind: 'error',
|
|
21
21
|
stderr: 'Missing --url=<api-url> (or KINDGI_API_URL / existing config).\n',
|
|
22
|
-
exitCode:
|
|
22
|
+
exitCode: 2,
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
25
|
if (typeof token !== 'string' || token === '') {
|
|
26
26
|
return {
|
|
27
27
|
kind: 'error',
|
|
28
28
|
stderr: 'Missing --token=<api-token> (or KINDGI_API_TOKEN / existing config).\n',
|
|
29
|
-
exitCode:
|
|
29
|
+
exitCode: 2,
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
const path = await saveHomeConfig({ apiUrl: url, token }, ctx.home);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/commands/blocks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../../src/commands/blocks.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAe,MAAM,YAAY,CAAC;AA0MvD,eAAO,MAAM,aAAa,EAAE,OAM3B,CAAC"}
|
package/dist/commands/blocks.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// Copyright (C) 2026 Kindgi Inc.
|
|
3
3
|
import { readFile } from 'node:fs/promises';
|
|
4
|
+
import { UsageError } from '../errors.js';
|
|
4
5
|
import { integerFlag, readJsonInput, requiredPositional, runSdk, stringFlag } from './helpers.js';
|
|
5
6
|
const KINDS = ['prompt', 'settings'];
|
|
6
7
|
/**
|
|
@@ -10,7 +11,7 @@ const KINDS = ['prompt', 'settings'];
|
|
|
10
11
|
function requiredBlockVersion(ctx) {
|
|
11
12
|
const version = stringFlag(ctx, 'block-version');
|
|
12
13
|
if (version === undefined)
|
|
13
|
-
throw new
|
|
14
|
+
throw new UsageError('--block-version=<semver> is required');
|
|
14
15
|
return version;
|
|
15
16
|
}
|
|
16
17
|
const PAGE_FLAGS = {
|
|
@@ -34,7 +35,7 @@ const list = {
|
|
|
34
35
|
run: (ctx) => runSdk(ctx, 'blocks list', async () => {
|
|
35
36
|
const kind = stringFlag(ctx, 'kind');
|
|
36
37
|
if (kind !== undefined && !KINDS.includes(kind)) {
|
|
37
|
-
throw new
|
|
38
|
+
throw new UsageError(`--kind must be one of ${KINDS.join(', ')}, got "${kind}"`);
|
|
38
39
|
}
|
|
39
40
|
const projectId = stringFlag(ctx, 'project');
|
|
40
41
|
const name = stringFlag(ctx, 'name');
|
|
@@ -118,7 +119,7 @@ const publish = {
|
|
|
118
119
|
run: (ctx) => runSdk(ctx, 'blocks publish', async () => {
|
|
119
120
|
const projectId = stringFlag(ctx, 'project');
|
|
120
121
|
if (projectId === undefined)
|
|
121
|
-
throw new
|
|
122
|
+
throw new UsageError('--project=<id> is required');
|
|
122
123
|
const prompt = stringFlag(ctx, 'prompt');
|
|
123
124
|
const settings = stringFlag(ctx, 'settings');
|
|
124
125
|
if (prompt === undefined && settings === undefined) {
|
|
@@ -128,7 +129,7 @@ const publish = {
|
|
|
128
129
|
return await ctx.client().blocks.publish(block, { projectId });
|
|
129
130
|
}
|
|
130
131
|
if (prompt !== undefined && settings !== undefined) {
|
|
131
|
-
throw new
|
|
132
|
+
throw new UsageError('Give one of --prompt or --settings');
|
|
132
133
|
}
|
|
133
134
|
const blockId = requiredPositional(ctx, 0, 'block-id');
|
|
134
135
|
const version = requiredBlockVersion(ctx);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocks.js","sourceRoot":"","sources":["../../src/commands/blocks.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG5C,OAAO,EA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;QACvD,OAAO,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3F,CAAC,CAAC;CACL,CAAC;AAEF,MAAM,SAAS,GAAgB;IAC7B,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,0DAA0D;IACvE,KAAK,EAAE,6DAA6D;IACpE,UAAU,EAAE;QACV,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qCAAqC,EAAE;KACxF;IACD,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE,CACX,MAAM,CAAC,GAAG,EAAE,kBAAkB,EAAE,KAAK,IAAI,EAAE;QACzC,MAAM,OAAO,GAAG,kBAAkB,CAAC,GAAG,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC;QACvD,OAAO,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1F,CAAC,CAAC;CACL,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAY;IACpC,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,QAAQ;IACd,WAAW,EACT,6HAA6H;IAC/H,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,CAAC;CACpE,CAAC"}
|
package/dist/commands/build.d.ts
CHANGED
|
@@ -24,8 +24,6 @@ export interface PackConfig {
|
|
|
24
24
|
readonly [k: string]: unknown;
|
|
25
25
|
}
|
|
26
26
|
export declare const DEFAULT_OUT_DIR = ".kindgi/build";
|
|
27
|
-
/** SOURCE_DATE_EPOCH=0 baseline — the build-server also pins epoch=0. */
|
|
28
|
-
export declare const DEFAULT_PUBLISHED_AT = "1970-01-01T00:00:00.000Z";
|
|
29
27
|
export declare const buildCommand: LeafCommand;
|
|
30
28
|
export declare function runBuild(ctx: CommandContext): Promise<CommandResult>;
|
|
31
29
|
/**
|
|
@@ -41,6 +39,16 @@ export declare function skippedScriptLines(skipped: readonly SkippedScript[]): s
|
|
|
41
39
|
* discovery: { tools: 'tools/**\/*.ts', ... } → ['tools', ...]
|
|
42
40
|
* discovery: { tools: 'kindgi/tools/** The config's discovery patterns with defaults filled in — what the indexer uses. */
|
|
43
41
|
export declare function discoveryPatternsOf(config: PackConfig): readonly string[];
|
|
42
|
+
/**
|
|
43
|
+
* An unpinned build's artifact version and publish time, from one clock
|
|
44
|
+
* reading: `YYYYMMDD.HHMMSS` and the ISO time, both UTC. Builds a second or
|
|
45
|
+
* more apart get different versions, so a second build the same day gets
|
|
46
|
+
* its own image tag; the versions sort in build order.
|
|
47
|
+
*/
|
|
48
|
+
export declare function buildTimeDefaults(now: Date): {
|
|
49
|
+
readonly artifactVersion: string;
|
|
50
|
+
readonly publishedAt: string;
|
|
51
|
+
};
|
|
44
52
|
export type BuildConfigLoader = (packDir: string) => Promise<PackConfig>;
|
|
45
53
|
export type { BuildRunners, LocalIndexResult };
|
|
46
54
|
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAyCA,OAAO,EAEL,KAAK,aAAa,EAGnB,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAyCA,OAAO,EAEL,KAAK,aAAa,EAGnB,MAAM,0BAA0B,CAAC;AAkBlC,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAGjB,MAAM,qBAAqB,CAAC;AAM7B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAMpD,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,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,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B,CAKA;AAwBD,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AACzE,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/commands/build.js
CHANGED
|
@@ -33,16 +33,16 @@ import { buildEnvelope, canonicaliseSignatureBody, sha256Hex } from '../build/en
|
|
|
33
33
|
import { devOnlyImports, resolveHostInstall, } from '../build/host-install.js';
|
|
34
34
|
import { readImageConfig } from '../build/image-config.js';
|
|
35
35
|
import { checkIntegrity } from '../build/integrity.js';
|
|
36
|
+
import { DEFAULT_JAVA_BUILD_IMAGE_REF, DEFAULT_JAVA_RUNTIME_IMAGE_REF, JAVA_PACK_SERVICE_COMMAND, collectJavaContextFiles, } from '../build/java-image.js';
|
|
36
37
|
import { nodeBaseImageFor } from '../build/node-image.js';
|
|
37
38
|
import { resolvePackRoots } from '../build/pack-root.js';
|
|
38
39
|
import { DEFAULT_PYTHON_BASE_IMAGE_REF, DEFAULT_UV_IMAGE_REF, PYTHON_LOCKFILES, PYTHON_PACK_SERVICE_COMMAND, collectPythonContextFiles, } from '../build/python-image.js';
|
|
39
|
-
import {
|
|
40
|
+
import { DEFAULT_SCALA_BUILD_IMAGE_REF, SCALA_PACK_SERVICE_COMMAND, collectScalaContextFiles, } from '../build/scala-image.js';
|
|
41
|
+
import { resolvePackJava, resolvePackPython, resolvePackScala } from '../dev/pack-code.js';
|
|
40
42
|
import { renderJson } from '../output.js';
|
|
41
43
|
import { loadPackConfig } from '../pack-config.js';
|
|
42
44
|
import { isPackageVersion } from '../package-manager.js';
|
|
43
45
|
export const DEFAULT_OUT_DIR = '.kindgi/build';
|
|
44
|
-
/** SOURCE_DATE_EPOCH=0 baseline — the build-server also pins epoch=0. */
|
|
45
|
-
export const DEFAULT_PUBLISHED_AT = '1970-01-01T00:00:00.000Z';
|
|
46
46
|
export const buildCommand = {
|
|
47
47
|
kind: 'leaf',
|
|
48
48
|
name: 'build',
|
|
@@ -84,11 +84,11 @@ export const buildCommand = {
|
|
|
84
84
|
},
|
|
85
85
|
'artifact-version': {
|
|
86
86
|
type: 'string',
|
|
87
|
-
description:
|
|
87
|
+
description: 'The artifact version, in the image and its signature. Default: the build time as `YYYYMMDD.HHMMSS` (UTC). For a reproducible build, pass `--artifact-version` and `--published-at`.',
|
|
88
88
|
},
|
|
89
89
|
'published-at': {
|
|
90
90
|
type: 'string',
|
|
91
|
-
description: 'The publish time (ISO 8601), in the image and its signature. Default: the
|
|
91
|
+
description: 'The publish time (ISO 8601), in the image and its signature. Default: the build time. For a reproducible build, pass `--artifact-version` and `--published-at`.',
|
|
92
92
|
},
|
|
93
93
|
tenant: {
|
|
94
94
|
type: 'string',
|
|
@@ -390,7 +390,13 @@ async function runLocalBuild(ctx, runners, args) {
|
|
|
390
390
|
}
|
|
391
391
|
lines(' Run it:');
|
|
392
392
|
lines(` docker run --rm -p 8080:8080 -e KINDGI_PACK_SERVICE_TOKEN=<token> --env-file <the pack's env> ${tag}`);
|
|
393
|
-
const service = args.language === 'python'
|
|
393
|
+
const service = args.language === 'python'
|
|
394
|
+
? PYTHON_PACK_SERVICE_COMMAND
|
|
395
|
+
: args.language === 'java'
|
|
396
|
+
? JAVA_PACK_SERVICE_COMMAND
|
|
397
|
+
: args.language === 'scala'
|
|
398
|
+
? SCALA_PACK_SERVICE_COMMAND
|
|
399
|
+
: PACK_SERVICE_COMMAND;
|
|
394
400
|
lines(` (the pack service: ${service.join(' ')})`);
|
|
395
401
|
lines('');
|
|
396
402
|
const rendered = renderJson({
|
|
@@ -459,6 +465,8 @@ function withBanner(result, banner) {
|
|
|
459
465
|
}
|
|
460
466
|
/** The pack's image context, by the pack's language. */
|
|
461
467
|
function preparePackContext(ctx, runners, args, expectedIndexPath, lines) {
|
|
468
|
+
if (args.language === 'java' || args.language === 'scala')
|
|
469
|
+
return prepareJvmContext(ctx, runners, args, args.language, expectedIndexPath, lines);
|
|
462
470
|
return args.language === 'python'
|
|
463
471
|
? preparePythonContext(ctx, runners, args, expectedIndexPath, lines)
|
|
464
472
|
: prepareNodeContext(runners, args, expectedIndexPath, lines);
|
|
@@ -709,6 +717,86 @@ async function preparePythonContext(ctx, runners, args, expectedIndexPath, lines
|
|
|
709
717
|
lines(` ✓ ${packFiles.files.length} pack file(s) in the image (the pack root, minus caches, virtualenvs and secrets); dependencies from ${PYTHON_LOCKFILES[packFiles.installer]}${system.packages.length > 0 ? `; Debian packages: ${system.packages.join(', ')}` : ''}`);
|
|
710
718
|
return { kind: 'ok', contextDir, counts: localIndex.counts, secrets: [] };
|
|
711
719
|
}
|
|
720
|
+
/**
|
|
721
|
+
* A JVM pack (Java, Scala): Maven or sbt compiles it with the pack's JDK
|
|
722
|
+
* and the local index runs on its classes, then its Containerfile
|
|
723
|
+
* (`build/java-image.ts`, `build/scala-image.ts`), the pack root as the
|
|
724
|
+
* context (`<out>/context`).
|
|
725
|
+
*/
|
|
726
|
+
async function prepareJvmContext(ctx, runners, args, language, expectedIndexPath, lines) {
|
|
727
|
+
const java = runners.jvm;
|
|
728
|
+
const name = language === 'java' ? 'Java' : 'Scala';
|
|
729
|
+
if (java === undefined)
|
|
730
|
+
return failure(`This CLI cannot build ${name} packs (no JVM build runners).\n`);
|
|
731
|
+
// The JDK and Maven or sbt as `kindgi dev` finds them; the build's own files under the output folder.
|
|
732
|
+
const resolved = language === 'java'
|
|
733
|
+
? await resolvePackJava(args.packDir, args.config, ctx.env)
|
|
734
|
+
: await resolvePackScala(args.packDir, args.config, ctx.env);
|
|
735
|
+
if (resolved.kind === 'err')
|
|
736
|
+
return failure(`kindgi build: ${resolved.message}\n`);
|
|
737
|
+
const code = { ...resolved.value, workDir: join(args.outDir, language) };
|
|
738
|
+
const env = {};
|
|
739
|
+
for (const name of ['PATH', 'HOME', 'TMPDIR']) {
|
|
740
|
+
const value = ctx.env[name];
|
|
741
|
+
if (value !== undefined)
|
|
742
|
+
env[name] = value;
|
|
743
|
+
}
|
|
744
|
+
const prepared = await java.prepare({ packDir: args.packDir, code, env });
|
|
745
|
+
if (prepared.kind === 'err') {
|
|
746
|
+
return failure(`The pack didn't compile — fix it before building:\n${prepared.errors.map((e) => ` ${e}`).join('\n')}\n`);
|
|
747
|
+
}
|
|
748
|
+
const localIndex = await java.runLocalIndexer({
|
|
749
|
+
packDir: args.packDir,
|
|
750
|
+
outputPath: expectedIndexPath,
|
|
751
|
+
artifactVersion: args.artifactVersion,
|
|
752
|
+
publishedAt: args.publishedAt,
|
|
753
|
+
code,
|
|
754
|
+
env,
|
|
755
|
+
});
|
|
756
|
+
if (localIndex.kind === 'err') {
|
|
757
|
+
return failure(`Local indexer failed: [${localIndex.code}] ${localIndex.message}${localIndex.filePath !== undefined ? ` (at ${localIndex.filePath})` : ''}\n`);
|
|
758
|
+
}
|
|
759
|
+
if (localIndex.fileErrors.length > 0) {
|
|
760
|
+
return failure(`Local indexer reported file errors — fix them before building:\n${localIndex.fileErrors
|
|
761
|
+
.map((e) => ` [${e.code}] ${e.message}`)
|
|
762
|
+
.join('\n')}\n`);
|
|
763
|
+
}
|
|
764
|
+
const tool = code.language === 'java' ? code.maven : code.sbt;
|
|
765
|
+
lines(` Indexing (${name} — ${code.javaHome ?? code.java}; ${tool.join(' ')})`);
|
|
766
|
+
lines(` ✓ ${localIndex.counts.tools} tools, ${localIndex.counts.guardrails} guardrails, ` +
|
|
767
|
+
`${localIndex.counts.agents} agents, ${localIndex.counts.flows} flows discovered`);
|
|
768
|
+
const packFiles = language === 'java'
|
|
769
|
+
? await collectJavaContextFiles(args.packDir)
|
|
770
|
+
: await collectScalaContextFiles(args.packDir);
|
|
771
|
+
if (packFiles.kind === 'error')
|
|
772
|
+
return failure(`${packFiles.message}\n`);
|
|
773
|
+
const image = args.config.image;
|
|
774
|
+
const system = checkAptPackages(image !== null && typeof image === 'object'
|
|
775
|
+
? image.systemPackages
|
|
776
|
+
: undefined, 'image.systemPackages in kindgi.config.json');
|
|
777
|
+
if (system.kind === 'err')
|
|
778
|
+
return failure(`kindgi build: ${system.message}\n`);
|
|
779
|
+
const containerfilePath = join(args.outDir, 'Containerfile');
|
|
780
|
+
await java.writeContainerfile({
|
|
781
|
+
language,
|
|
782
|
+
outputPath: containerfilePath,
|
|
783
|
+
artifactVersion: args.artifactVersion,
|
|
784
|
+
publishedAt: args.publishedAt,
|
|
785
|
+
buildTarget: args.buildTarget,
|
|
786
|
+
buildImageRef: language === 'java' ? DEFAULT_JAVA_BUILD_IMAGE_REF : DEFAULT_SCALA_BUILD_IMAGE_REF,
|
|
787
|
+
runtimeImageRef: DEFAULT_JAVA_RUNTIME_IMAGE_REF,
|
|
788
|
+
systemPackages: system.packages,
|
|
789
|
+
});
|
|
790
|
+
const contextDir = join(args.outDir, 'context');
|
|
791
|
+
await java.writeContext({
|
|
792
|
+
packDir: args.packDir,
|
|
793
|
+
files: packFiles.files,
|
|
794
|
+
containerfilePath,
|
|
795
|
+
contextDir,
|
|
796
|
+
});
|
|
797
|
+
lines(` ✓ ${packFiles.files.length} pack file(s) in the image (the pack root, minus build output, IDE files and secrets); classes and dependencies from ${language === 'java' ? 'pom.xml' : 'build.sbt'}${system.packages.length > 0 ? `; Debian packages: ${system.packages.join(', ')}` : ''}`);
|
|
798
|
+
return { kind: 'ok', contextDir, counts: localIndex.counts, secrets: [] };
|
|
799
|
+
}
|
|
712
800
|
async function resolveBuildArgs(ctx) {
|
|
713
801
|
// --path — pack root; auto-detects repo root separately so augment-
|
|
714
802
|
// mode packs (kindgi.config.ts under <repo>/kindgi/, package.json at
|
|
@@ -766,12 +854,12 @@ async function resolveBuildArgs(ctx) {
|
|
|
766
854
|
const outFlag = ctx.options.out;
|
|
767
855
|
const outDirRaw = typeof outFlag === 'string' && outFlag !== '' ? outFlag : DEFAULT_OUT_DIR;
|
|
768
856
|
const outDir = isAbsolute(outDirRaw) ? outDirRaw : resolve(packDir, outDirRaw);
|
|
769
|
-
// --artifact-version
|
|
857
|
+
// --artifact-version and --published-at: pinned, else the build time.
|
|
858
|
+
const defaults = buildTimeDefaults(new Date());
|
|
770
859
|
const avFlag = ctx.options['artifact-version'];
|
|
771
|
-
const artifactVersion = typeof avFlag === 'string' && avFlag !== '' ? avFlag :
|
|
772
|
-
// --published-at — SOURCE_DATE_EPOCH=0 baseline unless overridden.
|
|
860
|
+
const artifactVersion = typeof avFlag === 'string' && avFlag !== '' ? avFlag : defaults.artifactVersion;
|
|
773
861
|
const paFlag = ctx.options['published-at'];
|
|
774
|
-
const publishedAt = typeof paFlag === 'string' && paFlag !== '' ? paFlag :
|
|
862
|
+
const publishedAt = typeof paFlag === 'string' && paFlag !== '' ? paFlag : defaults.publishedAt;
|
|
775
863
|
// --tenant — flag > env block > KINDGI_TENANT_ID env var > error.
|
|
776
864
|
const tenantFlag = ctx.options.tenant;
|
|
777
865
|
const tenantId = typeof tenantFlag === 'string' && tenantFlag !== ''
|
|
@@ -898,12 +986,17 @@ export function discoveryPatternsOf(config) {
|
|
|
898
986
|
? discovery
|
|
899
987
|
: undefined));
|
|
900
988
|
}
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
989
|
+
/**
|
|
990
|
+
* An unpinned build's artifact version and publish time, from one clock
|
|
991
|
+
* reading: `YYYYMMDD.HHMMSS` and the ISO time, both UTC. Builds a second or
|
|
992
|
+
* more apart get different versions, so a second build the same day gets
|
|
993
|
+
* its own image tag; the versions sort in build order.
|
|
994
|
+
*/
|
|
995
|
+
export function buildTimeDefaults(now) {
|
|
996
|
+
const two = (n) => String(n).padStart(2, '0');
|
|
997
|
+
const day = `${now.getUTCFullYear()}${two(now.getUTCMonth() + 1)}${two(now.getUTCDate())}`;
|
|
998
|
+
const time = `${two(now.getUTCHours())}${two(now.getUTCMinutes())}${two(now.getUTCSeconds())}`;
|
|
999
|
+
return { artifactVersion: `${day}.${time}`, publishedAt: now.toISOString() };
|
|
907
1000
|
}
|
|
908
1001
|
function expandHome(path, home) {
|
|
909
1002
|
if (!path.startsWith('~'))
|