@kindgi/cli 0.1.11-rc.0 → 0.2.0-rc.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/README.md +77 -33
- package/dist/build/containerfile.d.ts +2 -0
- package/dist/build/containerfile.d.ts.map +1 -1
- package/dist/build/containerfile.js +14 -3
- package/dist/build/containerfile.js.map +1 -1
- package/dist/build/defaults.d.ts +2 -0
- package/dist/build/defaults.d.ts.map +1 -1
- package/dist/build/defaults.js +8 -0
- package/dist/build/defaults.js.map +1 -1
- package/dist/build/hosted.d.ts +2 -9
- package/dist/build/hosted.d.ts.map +1 -1
- package/dist/build/hosted.js +4 -2
- package/dist/build/hosted.js.map +1 -1
- package/dist/build/pack-blocks.d.ts +51 -0
- package/dist/build/pack-blocks.d.ts.map +1 -0
- package/dist/build/pack-blocks.js +98 -0
- package/dist/build/pack-blocks.js.map +1 -0
- package/dist/build/runners.d.ts +5 -1
- package/dist/build/runners.d.ts.map +1 -1
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/adapters.d.ts.map +1 -1
- package/dist/commands/adapters.js +12 -6
- package/dist/commands/adapters.js.map +1 -1
- package/dist/commands/agents.js +8 -8
- package/dist/commands/agents.js.map +1 -1
- package/dist/commands/auth.d.ts.map +1 -1
- package/dist/commands/auth.js +155 -39
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/blocks.d.ts.map +1 -1
- package/dist/commands/blocks.js +1 -1
- package/dist/commands/blocks.js.map +1 -1
- package/dist/commands/build.d.ts +17 -6
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +136 -89
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/connection-apps.d.ts +3 -0
- package/dist/commands/connection-apps.d.ts.map +1 -0
- package/dist/commands/connection-apps.js +239 -0
- package/dist/commands/connection-apps.js.map +1 -0
- package/dist/commands/connections.d.ts +44 -0
- package/dist/commands/connections.d.ts.map +1 -0
- package/dist/commands/connections.js +385 -0
- package/dist/commands/connections.js.map +1 -0
- package/dist/commands/conversations.js +1 -1
- package/dist/commands/conversations.js.map +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +178 -97
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.d.ts +10 -0
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +177 -87
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/doctor.js +7 -7
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/env-scoped.d.ts.map +1 -1
- package/dist/commands/env-scoped.js +37 -22
- package/dist/commands/env-scoped.js.map +1 -1
- package/dist/commands/env.d.ts.map +1 -1
- package/dist/commands/env.js +35 -22
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/eval-runs.js +6 -6
- package/dist/commands/eval-runs.js.map +1 -1
- package/dist/commands/eval-suites.js +9 -9
- package/dist/commands/eval-suites.js.map +1 -1
- package/dist/commands/exports.d.ts.map +1 -1
- package/dist/commands/exports.js +35 -9
- package/dist/commands/exports.js.map +1 -1
- package/dist/commands/feedback.d.ts.map +1 -1
- package/dist/commands/feedback.js +4 -3
- package/dist/commands/feedback.js.map +1 -1
- package/dist/commands/gate-policies.d.ts.map +1 -1
- package/dist/commands/gate-policies.js +7 -7
- package/dist/commands/gate-policies.js.map +1 -1
- package/dist/commands/helpers.d.ts +33 -0
- package/dist/commands/helpers.d.ts.map +1 -1
- package/dist/commands/helpers.js +49 -0
- package/dist/commands/helpers.js.map +1 -1
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +10 -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 +57 -45
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/judge-classes.js +4 -4
- package/dist/commands/judge-classes.js.map +1 -1
- package/dist/commands/judging-queue.d.ts +3 -0
- package/dist/commands/judging-queue.d.ts.map +1 -0
- package/dist/commands/judging-queue.js +105 -0
- package/dist/commands/judging-queue.js.map +1 -0
- package/dist/commands/judging-rules.d.ts +3 -0
- package/dist/commands/judging-rules.d.ts.map +1 -0
- package/dist/commands/judging-rules.js +351 -0
- package/dist/commands/judging-rules.js.map +1 -0
- package/dist/commands/judgments.d.ts.map +1 -1
- package/dist/commands/judgments.js +78 -36
- package/dist/commands/judgments.js.map +1 -1
- package/dist/commands/key.d.ts.map +1 -1
- package/dist/commands/key.js +107 -9
- package/dist/commands/key.js.map +1 -1
- package/dist/commands/license.d.ts.map +1 -1
- package/dist/commands/license.js +67 -15
- package/dist/commands/license.js.map +1 -1
- package/dist/commands/mail-triggers.d.ts +3 -0
- package/dist/commands/mail-triggers.d.ts.map +1 -0
- package/dist/commands/mail-triggers.js +290 -0
- package/dist/commands/mail-triggers.js.map +1 -0
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +4 -4
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/people.js +8 -14
- package/dist/commands/people.js.map +1 -1
- package/dist/commands/promote.js +1 -1
- package/dist/commands/promote.js.map +1 -1
- package/dist/commands/proposals.d.ts.map +1 -1
- package/dist/commands/proposals.js +83 -30
- package/dist/commands/proposals.js.map +1 -1
- package/dist/commands/run-waits.d.ts +68 -19
- package/dist/commands/run-waits.d.ts.map +1 -1
- package/dist/commands/run-waits.js +82 -8
- package/dist/commands/run-waits.js.map +1 -1
- package/dist/commands/runs.d.ts.map +1 -1
- package/dist/commands/runs.js +70 -30
- package/dist/commands/runs.js.map +1 -1
- package/dist/commands/schedules.d.ts.map +1 -1
- package/dist/commands/schedules.js +44 -20
- package/dist/commands/schedules.js.map +1 -1
- package/dist/commands/secrets-copy.d.ts.map +1 -1
- package/dist/commands/secrets-copy.js +20 -12
- package/dist/commands/secrets-copy.js.map +1 -1
- package/dist/commands/secrets.d.ts.map +1 -1
- package/dist/commands/secrets.js +13 -8
- package/dist/commands/secrets.js.map +1 -1
- package/dist/commands/service-accounts.d.ts.map +1 -1
- package/dist/commands/service-accounts.js +4 -2
- package/dist/commands/service-accounts.js.map +1 -1
- package/dist/commands/sign-in.js +2 -2
- package/dist/commands/sign-in.js.map +1 -1
- package/dist/commands/sites.d.ts.map +1 -1
- package/dist/commands/sites.js +13 -6
- package/dist/commands/sites.js.map +1 -1
- package/dist/commands/skills.d.ts +54 -3
- package/dist/commands/skills.d.ts.map +1 -1
- package/dist/commands/skills.js +169 -38
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/tokens.d.ts.map +1 -1
- package/dist/commands/tokens.js +9 -1
- package/dist/commands/tokens.js.map +1 -1
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +9 -8
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/commands/webhooks.d.ts.map +1 -1
- package/dist/commands/webhooks.js +72 -33
- package/dist/commands/webhooks.js.map +1 -1
- package/dist/config.d.ts +6 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +18 -3
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +12 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +2 -0
- package/dist/context.js.map +1 -1
- package/dist/deploy/pack-blocks-gate.d.ts +12 -0
- package/dist/deploy/pack-blocks-gate.d.ts.map +1 -0
- package/dist/deploy/pack-blocks-gate.js +34 -0
- package/dist/deploy/pack-blocks-gate.js.map +1 -0
- package/dist/deploy/post.d.ts +9 -0
- package/dist/deploy/post.d.ts.map +1 -1
- package/dist/deploy/post.js +20 -3
- package/dist/deploy/post.js.map +1 -1
- package/dist/dev/defaults.d.ts.map +1 -1
- package/dist/dev/defaults.js +8 -1
- package/dist/dev/defaults.js.map +1 -1
- package/dist/dev/dev-only-imports.d.ts +7 -4
- package/dist/dev/dev-only-imports.d.ts.map +1 -1
- package/dist/dev/dev-only-imports.js +5 -5
- package/dist/dev/dev-only-imports.js.map +1 -1
- package/dist/dev/log-view.d.ts +4 -4
- package/dist/dev/log-view.d.ts.map +1 -1
- package/dist/dev/log-view.js +4 -4
- package/dist/dev/log-view.js.map +1 -1
- package/dist/dev/pack-service.d.ts +7 -1
- package/dist/dev/pack-service.d.ts.map +1 -1
- package/dist/dev/pack-service.js +36 -3
- package/dist/dev/pack-service.js.map +1 -1
- package/dist/dev/preview-expiry.d.ts +6 -7
- package/dist/dev/preview-expiry.d.ts.map +1 -1
- package/dist/dev/preview-expiry.js +7 -8
- package/dist/dev/preview-expiry.js.map +1 -1
- package/dist/dev/providers.d.ts +2 -1
- package/dist/dev/providers.d.ts.map +1 -1
- package/dist/dev/providers.js +28 -12
- package/dist/dev/providers.js.map +1 -1
- package/dist/dev/runners.d.ts +19 -0
- package/dist/dev/runners.d.ts.map +1 -1
- package/dist/dev/runtime-container.d.ts.map +1 -1
- package/dist/dev/runtime-container.js +2 -2
- package/dist/dev/runtime-container.js.map +1 -1
- package/dist/dev/runtime-env.d.ts +2 -1
- package/dist/dev/runtime-env.d.ts.map +1 -1
- package/dist/dev/runtime-env.js +5 -5
- package/dist/dev/runtime-env.js.map +1 -1
- package/dist/dev/runtime-image.d.ts +2 -2
- package/dist/dev/runtime-image.d.ts.map +1 -1
- package/dist/dev/runtime-image.js +2 -2
- package/dist/dev/runtime-image.js.map +1 -1
- package/dist/dev/runtime-registry.d.ts +8 -10
- package/dist/dev/runtime-registry.d.ts.map +1 -1
- package/dist/dev/runtime-registry.js +27 -27
- package/dist/dev/runtime-registry.js.map +1 -1
- package/dist/dev/sandbox/index.js +1 -1
- package/dist/dev/sandbox/notices.d.ts +2 -0
- package/dist/dev/sandbox/notices.d.ts.map +1 -1
- package/dist/dev/sandbox/notices.js +5 -2
- package/dist/dev/sandbox/notices.js.map +1 -1
- package/dist/env/defaults.d.ts.map +1 -1
- package/dist/env/defaults.js +3 -1
- package/dist/env/defaults.js.map +1 -1
- package/dist/env/pack-env-plan.d.ts +4 -0
- package/dist/env/pack-env-plan.d.ts.map +1 -1
- package/dist/env/pack-env-plan.js +8 -2
- package/dist/env/pack-env-plan.js.map +1 -1
- package/dist/exports/create.d.ts +2 -0
- package/dist/exports/create.d.ts.map +1 -1
- package/dist/exports/create.js +10 -2
- package/dist/exports/create.js.map +1 -1
- package/dist/exports/plan.d.ts.map +1 -1
- package/dist/exports/plan.js +32 -0
- package/dist/exports/plan.js.map +1 -1
- package/dist/feedback/store.d.ts.map +1 -1
- package/dist/feedback/store.js +8 -19
- package/dist/feedback/store.js.map +1 -1
- package/dist/help.d.ts +6 -0
- package/dist/help.d.ts.map +1 -1
- package/dist/help.js +35 -1
- package/dist/help.js.map +1 -1
- package/dist/init/agent-access.d.ts +3 -2
- package/dist/init/agent-access.d.ts.map +1 -1
- package/dist/init/agent-access.js +5 -1
- package/dist/init/agent-access.js.map +1 -1
- package/dist/init/augment-scaffolder.d.ts +7 -0
- package/dist/init/augment-scaffolder.d.ts.map +1 -1
- package/dist/init/augment-scaffolder.js +15 -14
- package/dist/init/augment-scaffolder.js.map +1 -1
- package/dist/init/dependency-specs.d.ts +1 -0
- package/dist/init/dependency-specs.d.ts.map +1 -1
- package/dist/init/dependency-specs.js +27 -7
- package/dist/init/dependency-specs.js.map +1 -1
- package/dist/init/java-augment.d.ts +3 -0
- package/dist/init/java-augment.d.ts.map +1 -1
- package/dist/init/java-augment.js +16 -15
- package/dist/init/java-augment.js.map +1 -1
- package/dist/init/python-augment.d.ts +3 -0
- package/dist/init/python-augment.d.ts.map +1 -1
- package/dist/init/python-augment.js +15 -14
- package/dist/init/python-augment.js.map +1 -1
- package/dist/init/scala-augment.d.ts +8 -1
- package/dist/init/scala-augment.d.ts.map +1 -1
- package/dist/init/scala-augment.js +32 -17
- package/dist/init/scala-augment.js.map +1 -1
- package/dist/key/defaults.d.ts.map +1 -1
- package/dist/key/defaults.js +6 -1
- package/dist/key/defaults.js.map +1 -1
- package/dist/key/runners.d.ts +4 -1
- package/dist/key/runners.d.ts.map +1 -1
- package/dist/license/renew.d.ts +6 -0
- package/dist/license/renew.d.ts.map +1 -1
- package/dist/license/renew.js +8 -5
- package/dist/license/renew.js.map +1 -1
- package/dist/main.d.ts +10 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +19 -5
- package/dist/main.js.map +1 -1
- package/dist/output.d.ts +6 -0
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +8 -0
- package/dist/output.js.map +1 -1
- package/dist/parse.d.ts +1 -1
- package/dist/parse.d.ts.map +1 -1
- package/dist/parse.js +1 -1
- package/dist/parse.js.map +1 -1
- package/dist/private-file.d.ts +23 -0
- package/dist/private-file.d.ts.map +1 -0
- package/dist/private-file.js +65 -0
- package/dist/private-file.js.map +1 -0
- package/dist/progress-head.d.ts +13 -0
- package/dist/progress-head.d.ts.map +1 -0
- package/dist/progress-head.js +30 -0
- package/dist/progress-head.js.map +1 -0
- package/dist/progress-lines.d.ts +29 -0
- package/dist/progress-lines.d.ts.map +1 -0
- package/dist/progress-lines.js +35 -0
- package/dist/progress-lines.js.map +1 -0
- package/dist/sdk-skills/kindgi-authoring-agents/SKILL.md +6 -6
- package/dist/sdk-skills/kindgi-authoring-flows/SKILL.md +1 -1
- package/dist/sdk-skills/kindgi-authoring-guardrails/SKILL.md +2 -2
- package/dist/sdk-skills/kindgi-authoring-mcp-servers/SKILL.md +1 -1
- package/dist/sdk-skills/kindgi-authoring-providers/SKILL.md +13 -3
- package/dist/sdk-skills/kindgi-authoring-tools/SKILL.md +47 -9
- package/dist/sdk-skills/kindgi-fix-corrections/SKILL.md +262 -0
- package/dist/sdk-skills/kindgi-framework-feedback/SKILL.md +1 -1
- package/dist/sdk-skills/kindgi-getting-started/SKILL.md +46 -9
- package/dist/sdk-skills/kindgi-java-authoring-agents/SKILL.md +5 -5
- package/dist/sdk-skills/kindgi-java-authoring-flows/SKILL.md +1 -1
- package/dist/sdk-skills/kindgi-java-authoring-guardrails/SKILL.md +1 -1
- package/dist/sdk-skills/kindgi-java-authoring-tools/SKILL.md +101 -11
- package/dist/sdk-skills/kindgi-java-getting-started/SKILL.md +41 -9
- package/dist/sdk-skills/kindgi-python-authoring-agents/SKILL.md +4 -4
- package/dist/sdk-skills/kindgi-python-authoring-flows/SKILL.md +1 -1
- package/dist/sdk-skills/kindgi-python-authoring-guardrails/SKILL.md +1 -1
- package/dist/sdk-skills/kindgi-python-authoring-tools/SKILL.md +53 -10
- package/dist/sdk-skills/kindgi-python-getting-started/SKILL.md +42 -11
- package/dist/sdk-skills/kindgi-scala-authoring-agents/SKILL.md +5 -5
- package/dist/sdk-skills/kindgi-scala-authoring-flows/SKILL.md +1 -1
- package/dist/sdk-skills/kindgi-scala-authoring-guardrails/SKILL.md +1 -1
- package/dist/sdk-skills/kindgi-scala-authoring-tools/SKILL.md +92 -9
- package/dist/sdk-skills/kindgi-scala-getting-started/SKILL.md +41 -9
- package/dist/sdk-skills/kindgi-using/SKILL.md +63 -21
- package/dist/templates/drupal/AGENTS.md +2 -1
- package/dist/templates/follow-up/.nvmrc +1 -0
- package/dist/templates/follow-up/AGENTS.md +83 -0
- package/dist/templates/follow-up/README.md.tmpl +111 -0
- package/dist/templates/follow-up/agents/follow-up/index.test.ts.tmpl +26 -0
- package/dist/templates/follow-up/agents/follow-up/index.ts.tmpl +53 -0
- package/dist/templates/follow-up/gitignore +8 -0
- package/dist/templates/follow-up/kindgi.config.ts.tmpl +45 -0
- package/dist/templates/follow-up/package.json.tmpl +30 -0
- package/dist/templates/follow-up/pnpm-workspace.yaml +9 -0
- package/dist/templates/follow-up/tools/gmail-send/index.test.ts.tmpl +60 -0
- package/dist/templates/follow-up/tools/gmail-send/index.ts.tmpl +14 -0
- package/dist/templates/follow-up/tsconfig.json.tmpl +27 -0
- package/dist/templates/follow-up/vitest.config.ts.tmpl +14 -0
- package/dist/templates/java/AGENTS.md +2 -1
- package/dist/templates/minimal/AGENTS.md +2 -1
- package/dist/templates/python/AGENTS.md +2 -1
- package/dist/templates/sample/AGENTS.md +2 -1
- package/dist/templates/scala/AGENTS.md +2 -1
- package/dist/templates/woocommerce/AGENTS.md +12 -3
- package/dist/templates/woocommerce/README.md.tmpl +29 -5
- package/dist/templates/woocommerce/agents/store-agent/index.test.ts.tmpl +38 -7
- package/dist/templates/woocommerce/agents/store-agent/index.ts.tmpl +7 -12
- package/dist/templates/woocommerce/blocks/store-agent-prompt.json.tmpl +10 -0
- package/dist/templates/woocommerce/blocks/store-agent-prompt.liquid.tmpl +7 -0
- package/dist/templates/woocommerce/kindgi.config.ts.tmpl +1 -0
- package/dist/value-target.d.ts +4 -2
- package/dist/value-target.d.ts.map +1 -1
- package/dist/value-target.js +8 -5
- package/dist/value-target.js.map +1 -1
- package/package.json +13 -13
package/dist/commands/dev.js
CHANGED
|
@@ -32,13 +32,15 @@
|
|
|
32
32
|
*/
|
|
33
33
|
import { randomBytes, randomUUID } from 'node:crypto';
|
|
34
34
|
import { existsSync } from 'node:fs';
|
|
35
|
-
import {
|
|
35
|
+
import { readFile, unlink } from 'node:fs/promises';
|
|
36
36
|
import { homedir } from 'node:os';
|
|
37
37
|
import { basename, isAbsolute, join, resolve } from 'node:path';
|
|
38
38
|
import { createInterface } from 'node:readline';
|
|
39
|
-
import { discoveryRoots, findKindgiConfig, packLanguage, resolveDiscovery, } from '@kindgi/handler-runtime';
|
|
39
|
+
import { blocksFolder, codePatterns, createGlobMatcher, discoveryRoots, findKindgiConfig, packLanguage, readPackBlocks, resolveDiscovery, } from '@kindgi/handler-runtime';
|
|
40
40
|
import { LOCAL_ENV_NAME, describeUnreadable, displayEnvPath, namesInAppFiles, packValues, readPackEnv, runtimeValues, } from '@kindgi/secrets-dotenv';
|
|
41
41
|
import { CORS_ORIGINS_VAR, EXPORT_SIGNING_KEY_PATH_VAR, PUBLIC_TOKEN_KEY_PATH_VAR, parseCorsOrigins, } from '@kindgi/env-schema';
|
|
42
|
+
import { scrubText } from '@kindgi/log';
|
|
43
|
+
import { indexerPredatesBlocks, packIndexerName } from '../build/pack-blocks.js';
|
|
42
44
|
import { ALREADY_RUNNING_EXIT_CODE, alreadyRunning } from '../dev/already-running.js';
|
|
43
45
|
import { LocalPortsRefused, localPortsRefused, refusedHere, } from '../dev/blocked.js';
|
|
44
46
|
import { DEV_LOCK_FILE, osProcesses, ownerIsLive, takeDevLock, } from '../dev/dev-lock.js';
|
|
@@ -47,7 +49,7 @@ import { DEV_GOOGLE_CREDENTIALS_VAR, VERTEX_PROVIDER_ID, isVertexRegistration, r
|
|
|
47
49
|
import { DEFAULT_DEV_LOG_VIEW, parseDevLogFlags, resolveDevLogView, runtimeLogLevels, showIndexerLine, showLine, showText, sourceLogEnv, } from '../dev/log-view.js';
|
|
48
50
|
import { isJvmPackCode, resolvePackCode } from '../dev/pack-code.js';
|
|
49
51
|
import { devPackEnv, devPackEnvFiles } from '../dev/pack-env.js';
|
|
50
|
-
import { createPackRefresher, showPackEvent } from '../dev/pack-service.js';
|
|
52
|
+
import { createPackRefresher, showBlockWritten, showPackEvent } from '../dev/pack-service.js';
|
|
51
53
|
import { PORT_SEARCH_SPAN, firstFreePort } from '../dev/port.js';
|
|
52
54
|
import { devRuntimeSource, previewExpiryWarning, previewRefusalHint, readLicenseStatus, } from '../dev/preview-expiry.js';
|
|
53
55
|
import { resolveDevProject } from '../dev/project.js';
|
|
@@ -63,12 +65,13 @@ import { PYPI_NO_BUNDLER } from '../esbuild-loader.js';
|
|
|
63
65
|
import { openUrlInBrowser } from '../open-url.js';
|
|
64
66
|
import { renderJson } from '../output.js';
|
|
65
67
|
import { binDisplay, cliInstall, detectBinRunner } from '../package-manager.js';
|
|
68
|
+
import { writePrivateFile } from '../private-file.js';
|
|
66
69
|
import { MODELS_GUIDE } from '../providers/models-guide.js';
|
|
67
70
|
import { loadProviderPresets } from '../providers/preset-loader.js';
|
|
68
71
|
import { CLI_VERSION } from '../version-info.js';
|
|
69
72
|
import { consoleUrlOf, couldNotOpen } from './console.js';
|
|
70
73
|
import { defaultSdkSkillsRoot } from './init.js';
|
|
71
|
-
import {
|
|
74
|
+
import { describeDevSkillsRefresh, refreshSkillsForDev } from './skills.js';
|
|
72
75
|
export const devCommand = {
|
|
73
76
|
kind: 'leaf',
|
|
74
77
|
name: 'dev',
|
|
@@ -141,10 +144,10 @@ export const devCommand = {
|
|
|
141
144
|
description: 'Let `docker compose` recreate the bundled Postgres if its definition changed (needs compose). By default an existing container is reused.',
|
|
142
145
|
},
|
|
143
146
|
// The runtime's and the pack service's records: what's shown, and how.
|
|
144
|
-
// `--quiet` (a global flag) keeps errors only.
|
|
147
|
+
// `--quiet` (a global flag) keeps errors and warnings only.
|
|
145
148
|
'log-level': {
|
|
146
149
|
type: 'string',
|
|
147
|
-
description: "The lowest level of the log records shown: error, warn, info, debug or trace. Default: `KINDGI_LOG_LEVEL` (the shell's, then the env files'), else info; with `--quiet`,
|
|
150
|
+
description: "The lowest level of the log records shown: error, warn, info, debug or trace. Default: `KINDGI_LOG_LEVEL` (the shell's, then the env files'), else info; with `--quiet`, warn.",
|
|
148
151
|
},
|
|
149
152
|
log: {
|
|
150
153
|
type: 'string',
|
|
@@ -182,11 +185,18 @@ function emitProgress(msg) {
|
|
|
182
185
|
return;
|
|
183
186
|
emitProblem(msg);
|
|
184
187
|
}
|
|
185
|
-
/** A progress line that's an error: shown under `--quiet` too. */
|
|
188
|
+
/** A progress line that's an error or a warning: shown under `--quiet` too. */
|
|
186
189
|
function emitProblem(msg) {
|
|
187
190
|
process.stderr.write(`${stoppingLineOpen ? '\n' : ''} ${msg}\n`);
|
|
188
191
|
stoppingLineOpen = false;
|
|
189
192
|
}
|
|
193
|
+
/** The dev sandbox's lines, then its warnings: those are said under `--quiet` too. */
|
|
194
|
+
function emitSandboxLines(outcome) {
|
|
195
|
+
for (const line of outcome.lines)
|
|
196
|
+
emitProgress(line);
|
|
197
|
+
for (const line of outcome.warnings)
|
|
198
|
+
emitProblem(line);
|
|
199
|
+
}
|
|
190
200
|
/**
|
|
191
201
|
* How logs show this session (`dev/log-view.ts`): set from the flags as
|
|
192
202
|
* `runDev` starts, and again once the env files are read.
|
|
@@ -366,7 +376,7 @@ async function runDevForPack(ctx, args, dev, configFile, stderrIsTTY, lock) {
|
|
|
366
376
|
emitProgress(`✓ Google credentials: ${google.credentials.path} (${google.credentials.who}), mounted read-only for Vertex AI`);
|
|
367
377
|
}
|
|
368
378
|
else if (declaredVertex.length > 0) {
|
|
369
|
-
|
|
379
|
+
emitProblem(`⚠ ${vertexCredentialsHint(declaredVertex, ctx.env)}`);
|
|
370
380
|
}
|
|
371
381
|
// The pack service runs sandboxed where this machine can: the code a
|
|
372
382
|
// coding agent writes can't read your keys or reach Docker. Where it
|
|
@@ -382,8 +392,7 @@ async function runDevForPack(ctx, args, dev, configFile, stderrIsTTY, lock) {
|
|
|
382
392
|
if (devSandbox.kind === 'error') {
|
|
383
393
|
return { kind: 'error', stderr: `kindgi dev: ${devSandbox.message}\n`, exitCode: 1 };
|
|
384
394
|
}
|
|
385
|
-
|
|
386
|
-
emitProgress(line);
|
|
395
|
+
emitSandboxLines(devSandbox);
|
|
387
396
|
const sandboxNotices = new Set();
|
|
388
397
|
// The runtime's port, before anything starts. Taken without `--port`
|
|
389
398
|
// (another `kindgi dev`, say): the next free one, which `.kindgirc.json`
|
|
@@ -417,7 +426,7 @@ async function runDevForPack(ctx, args, dev, configFile, stderrIsTTY, lock) {
|
|
|
417
426
|
};
|
|
418
427
|
}
|
|
419
428
|
if (args.recreateServices) {
|
|
420
|
-
|
|
429
|
+
emitProblem('⚠ --recreate-services: the shared Postgres may be recreated; every kindgi dev on this machine using it reconnects');
|
|
421
430
|
}
|
|
422
431
|
emitProgress('Starting Postgres...');
|
|
423
432
|
emitProgress(' first-run image pull can take 30-90s; cached boots are ~5-10s');
|
|
@@ -442,7 +451,7 @@ async function runDevForPack(ctx, args, dev, configFile, stderrIsTTY, lock) {
|
|
|
442
451
|
? "✓ Postgres: started with docker (docker compose isn't available)"
|
|
443
452
|
: '✓ Postgres: started with docker compose');
|
|
444
453
|
for (const note of outcome.handle.notes ?? [])
|
|
445
|
-
|
|
454
|
+
emitProblem(`⚠ ${note}`);
|
|
446
455
|
}
|
|
447
456
|
const kindgircPath = join(args.packDir, '.kindgirc.json');
|
|
448
457
|
const persisted = await readPersistedRc(kindgircPath);
|
|
@@ -498,7 +507,7 @@ async function runDevForPack(ctx, args, dev, configFile, stderrIsTTY, lock) {
|
|
|
498
507
|
}
|
|
499
508
|
catch (err) {
|
|
500
509
|
if (err.code !== 'ENOENT') {
|
|
501
|
-
|
|
510
|
+
emitProblem(`⚠ --reset: could not remove .kindgirc.json: ${err.message}`);
|
|
502
511
|
}
|
|
503
512
|
}
|
|
504
513
|
if (projectDatabases === undefined) {
|
|
@@ -569,13 +578,17 @@ async function runDevForPack(ctx, args, dev, configFile, stderrIsTTY, lock) {
|
|
|
569
578
|
if (sandboxNotices.has(line))
|
|
570
579
|
return;
|
|
571
580
|
sandboxNotices.add(line);
|
|
572
|
-
|
|
581
|
+
emitProblem(`⚠ ${line}`);
|
|
573
582
|
},
|
|
574
583
|
onLog: (line, stream) => emitOutput(showText('pack', line, logView, stream)),
|
|
575
584
|
onEvent: (event) => {
|
|
576
585
|
for (const output of showPackEvent(event, logView))
|
|
577
586
|
emitOutput(output);
|
|
578
587
|
},
|
|
588
|
+
blocks: {
|
|
589
|
+
pattern: projectEnv.blocksPattern,
|
|
590
|
+
onWritten: (write, written) => emitProgress(` ${showBlockWritten(write, written)}`),
|
|
591
|
+
},
|
|
579
592
|
};
|
|
580
593
|
// The front listens for the whole session; children come and go behind
|
|
581
594
|
// it. It keeps the previous session's port, so a runtime started with
|
|
@@ -597,7 +610,7 @@ async function runDevForPack(ctx, args, dev, configFile, stderrIsTTY, lock) {
|
|
|
597
610
|
}
|
|
598
611
|
if (previous.packServicePort === undefined)
|
|
599
612
|
throw err;
|
|
600
|
-
|
|
613
|
+
emitProblem(`⚠ the pack service's port ${previous.packServicePort} is taken: using another one${args.runtimeUrl !== undefined ? ' (restart your runtime with the new runtime.env)' : ''}`);
|
|
601
614
|
await pack.close().catch(() => undefined);
|
|
602
615
|
pack = dev.createPackService(packOptions);
|
|
603
616
|
packFront = await pack.listen();
|
|
@@ -625,7 +638,10 @@ async function runDevForPack(ctx, args, dev, configFile, stderrIsTTY, lock) {
|
|
|
625
638
|
onBuild: async (build) => {
|
|
626
639
|
if (build.externals === undefined)
|
|
627
640
|
return;
|
|
628
|
-
|
|
641
|
+
const checked = await devOnly.check(build.externals);
|
|
642
|
+
for (const line of checked.warnings)
|
|
643
|
+
emitProblem(` ${line}`);
|
|
644
|
+
for (const line of checked.lines)
|
|
629
645
|
emitProgress(` ${line}`);
|
|
630
646
|
},
|
|
631
647
|
}),
|
|
@@ -716,6 +732,17 @@ async function runDevForPack(ctx, args, dev, configFile, stderrIsTTY, lock) {
|
|
|
716
732
|
})
|
|
717
733
|
: emptyReport();
|
|
718
734
|
emitBootIndex(bootIndex, bootReport, discoveryRoots(projectEnv.discoveryPatterns));
|
|
735
|
+
if (bootIndex.kind === 'ok') {
|
|
736
|
+
const predates = await indexerPredatesBlocks({
|
|
737
|
+
packDir: args.packDir,
|
|
738
|
+
pattern: projectEnv.blocksPattern,
|
|
739
|
+
blocksCounted: bootIndex.counts.blocks !== undefined,
|
|
740
|
+
indexer: packIndexerName(code.value.language),
|
|
741
|
+
release: CLI_VERSION,
|
|
742
|
+
});
|
|
743
|
+
if (predates !== undefined)
|
|
744
|
+
emitProblem(` ⚠ ${predates}`);
|
|
745
|
+
}
|
|
719
746
|
// Hints run the project's own kindgi through its package manager — or,
|
|
720
747
|
// for a Python pack (no npm project), the kindgi on PATH.
|
|
721
748
|
const runner = await detectBinRunner(args.packDir, code.value.language, undefined, ctx.env);
|
|
@@ -729,7 +756,7 @@ async function runDevForPack(ctx, args, dev, configFile, stderrIsTTY, lock) {
|
|
|
729
756
|
: { kind: 'database', url: databaseUrl };
|
|
730
757
|
if (providersTarget.kind === 'bundled') {
|
|
731
758
|
await adoptLegacyBundledEntries(devProvidersRecordPath(args.packDir), providersTarget.database, server.tenantId).catch((err) => {
|
|
732
|
-
|
|
759
|
+
emitProblem(` ⚠ could not update ${join('.kindgi', 'dev', 'providers.json')}: ${err.message}. Providers this pack registered before 0.1.4 may read as not its own.`);
|
|
733
760
|
});
|
|
734
761
|
}
|
|
735
762
|
await applyDeclaredProviders({
|
|
@@ -761,27 +788,13 @@ async function runDevForPack(ctx, args, dev, configFile, stderrIsTTY, lock) {
|
|
|
761
788
|
.map((p) => p.id)
|
|
762
789
|
.filter((id) => id === VERTEX_PROVIDER_ID && !declaredVertex.includes(id));
|
|
763
790
|
if (byHand.length > 0)
|
|
764
|
-
|
|
791
|
+
emitProblem(`⚠ ${vertexCredentialsHint(byHand, ctx.env)}`);
|
|
765
792
|
}
|
|
766
793
|
// A preview runtime near the end of its life (90 days after its
|
|
767
|
-
// release
|
|
794
|
+
// release): from 30 days before, the way to a newer one.
|
|
768
795
|
const previewWarning = previewExpiryWarning(await readLicenseStatus(client), devRuntimeSource(args));
|
|
769
796
|
if (previewWarning !== undefined)
|
|
770
|
-
|
|
771
|
-
const bannerLines = renderDevBanner({
|
|
772
|
-
baseUrl: server.baseUrl,
|
|
773
|
-
consoleMounted: server.consoleMounted === true,
|
|
774
|
-
tenantId: server.tenantId,
|
|
775
|
-
token: server.token,
|
|
776
|
-
providers,
|
|
777
|
-
packDir: args.packDir,
|
|
778
|
-
bootIndex,
|
|
779
|
-
bootReport,
|
|
780
|
-
discoveryRoots: discoveryRoots(projectEnv.discoveryPatterns),
|
|
781
|
-
...(servicesHandle !== undefined && { autoStartedServices: servicesHandle.services }),
|
|
782
|
-
corsOrigins: publicRunTokens.corsOrigins,
|
|
783
|
-
...(google.credentials !== undefined && { googleCredentials: google.credentials }),
|
|
784
|
-
});
|
|
797
|
+
emitProblem(previewWarning);
|
|
785
798
|
// Write `.kindgirc.json` to the pack root so a SECOND terminal in
|
|
786
799
|
// the same directory (`cd <pack>; kindgi runs start ...`) picks up
|
|
787
800
|
// the api URL + bearer token automatically. Same file the config
|
|
@@ -799,25 +812,31 @@ async function runDevForPack(ctx, args, dev, configFile, stderrIsTTY, lock) {
|
|
|
799
812
|
// tenant row and orphans the pack's registered primitives under old
|
|
800
813
|
// tenant UUIDs. Persisting keeps the "run this pack" identity
|
|
801
814
|
// stable across restarts.
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
815
|
+
const kindgircWritten = await writeKindgirc(kindgircPath, {
|
|
816
|
+
apiUrl: server.baseUrl,
|
|
817
|
+
token: server.token,
|
|
818
|
+
tenantId: server.tenantId,
|
|
819
|
+
userId: server.userId,
|
|
820
|
+
packServicePort: packFront.port,
|
|
821
|
+
packServiceToken: pack.token,
|
|
822
|
+
});
|
|
823
|
+
// Where the token is in full: the banners show only its ends.
|
|
824
|
+
const tokenFile = kindgircWritten ? '.kindgirc.json' : join('.kindgi', 'dev', 'runtime.env');
|
|
825
|
+
const bannerLines = renderDevBanner({
|
|
826
|
+
baseUrl: server.baseUrl,
|
|
827
|
+
consoleMounted: server.consoleMounted === true,
|
|
828
|
+
tenantId: server.tenantId,
|
|
829
|
+
token: server.token,
|
|
830
|
+
tokenFile,
|
|
831
|
+
providers,
|
|
832
|
+
packDir: args.packDir,
|
|
833
|
+
bootIndex,
|
|
834
|
+
bootReport,
|
|
835
|
+
discoveryRoots: discoveryRoots(projectEnv.discoveryPatterns),
|
|
836
|
+
...(servicesHandle !== undefined && { autoStartedServices: servicesHandle.services }),
|
|
837
|
+
corsOrigins: publicRunTokens.corsOrigins,
|
|
838
|
+
...(google.credentials !== undefined && { googleCredentials: google.credentials }),
|
|
839
|
+
});
|
|
821
840
|
// Where it serves, for a second kindgi dev to say (`dev.lock`).
|
|
822
841
|
await lock
|
|
823
842
|
.update({
|
|
@@ -842,7 +861,7 @@ async function runDevForPack(ctx, args, dev, configFile, stderrIsTTY, lock) {
|
|
|
842
861
|
emitProgress(` Project ${project.name} · database ${project.database}`);
|
|
843
862
|
}
|
|
844
863
|
emitProgress(` Tenant ${server.tenantId}`);
|
|
845
|
-
emitProgress(` Token ${server.token}`);
|
|
864
|
+
emitProgress(` Token ${describeDevToken(server.token, tokenFile)}`);
|
|
846
865
|
if (providers !== undefined) {
|
|
847
866
|
emitProgress(` Models ${describeModels(providers)}`);
|
|
848
867
|
}
|
|
@@ -871,7 +890,10 @@ async function runDevForPack(ctx, args, dev, configFile, stderrIsTTY, lock) {
|
|
|
871
890
|
emitProgress(' Hit a framework rough edge?');
|
|
872
891
|
emitProgress(` echo "…" | ${kindgi('feedback', 'write', '--kind=bug', '--title="…"', '--body-stdin')} (appends to FEEDBACK.md)`);
|
|
873
892
|
emitProgress('');
|
|
874
|
-
await
|
|
893
|
+
await emitSkillsRefresh(args.packDir, code.value.language, {
|
|
894
|
+
sync: kindgi('skills', 'sync'),
|
|
895
|
+
force: kindgi('skills', 'sync', '--force'),
|
|
896
|
+
});
|
|
875
897
|
if (args.watch) {
|
|
876
898
|
emitProgress(` Watching ${args.packDir}`);
|
|
877
899
|
emitProgress(' Ctrl+C to stop.');
|
|
@@ -880,10 +902,13 @@ async function runDevForPack(ctx, args, dev, configFile, stderrIsTTY, lock) {
|
|
|
880
902
|
if (args.open) {
|
|
881
903
|
if (server.consoleMounted === true) {
|
|
882
904
|
const opened = await (ctx.openUrl ?? openUrlInBrowser)(consoleUrlOf(server.baseUrl));
|
|
883
|
-
|
|
905
|
+
if (opened.ok)
|
|
906
|
+
emitProgress(' Opened the console in your browser.');
|
|
907
|
+
else
|
|
908
|
+
emitProblem(`⚠ ${couldNotOpen(opened.reason)}`);
|
|
884
909
|
}
|
|
885
910
|
else {
|
|
886
|
-
|
|
911
|
+
emitProblem('⚠ --open: this runtime serves no console, so there is nothing to open.');
|
|
887
912
|
}
|
|
888
913
|
emitProgress('');
|
|
889
914
|
}
|
|
@@ -961,6 +986,12 @@ async function runDevForPack(ctx, args, dev, configFile, stderrIsTTY, lock) {
|
|
|
961
986
|
patterns: projectEnv.discoveryPatterns,
|
|
962
987
|
onWatchFailed,
|
|
963
988
|
}));
|
|
989
|
+
// The pack's blocks: their files and their templates, read into the index again.
|
|
990
|
+
watchHandles.push(await dev.watchPack(args.packDir, untilStopped(ctx.stopSignal, () => onRefresh()), {
|
|
991
|
+
debounceMs: DEFAULT_WATCH_DEBOUNCE_MS,
|
|
992
|
+
...(await blocksWatch(args.packDir, projectEnv.blocksPattern)),
|
|
993
|
+
onWatchFailed,
|
|
994
|
+
}));
|
|
964
995
|
// The env files: the same code, restarted with the new environment.
|
|
965
996
|
watchHandles.push(await dev.watchPack(args.packDir, untilStopped(ctx.stopSignal, () => onRefresh()), {
|
|
966
997
|
debounceMs: DEFAULT_WATCH_DEBOUNCE_MS,
|
|
@@ -1014,7 +1045,7 @@ async function runDevForPack(ctx, args, dev, configFile, stderrIsTTY, lock) {
|
|
|
1014
1045
|
const stdout = ctx.globals.formatRequested ? renderJson(summary, ctx.globals.format).stdout : '';
|
|
1015
1046
|
return {
|
|
1016
1047
|
kind: 'ok',
|
|
1017
|
-
// --quiet: errors only, so no summary.
|
|
1048
|
+
// --quiet: errors and warnings only, so no summary.
|
|
1018
1049
|
rendered: {
|
|
1019
1050
|
stdout,
|
|
1020
1051
|
stderr: args.watch || logView.quiet ? '' : `${bannerLines.join('\n')}\n`,
|
|
@@ -1090,16 +1121,18 @@ async function loadDevProjectEnv(ctx, packDir) {
|
|
|
1090
1121
|
? `env files: none yet (reads ${label(env.files.read)})`
|
|
1091
1122
|
: `✓ env files: ${label(env.present)} — ${Object.keys(packValues(env.values)).length} name(s) for the pack`);
|
|
1092
1123
|
for (const line of describeEnvDiagnostics(packDir, env.diagnostics))
|
|
1093
|
-
|
|
1124
|
+
emitProblem(` ! ${line}`);
|
|
1094
1125
|
const discovery = settings.config?.discovery;
|
|
1095
1126
|
const language = settings.config !== undefined ? packLanguage(settings.config) : 'node';
|
|
1127
|
+
const resolved = resolveDiscovery(typeof discovery === 'object' && discovery !== null
|
|
1128
|
+
? discovery
|
|
1129
|
+
: undefined, language);
|
|
1096
1130
|
return {
|
|
1097
1131
|
kind: 'ok',
|
|
1098
1132
|
localEnvFiles: settings.localEnvFiles,
|
|
1099
1133
|
runtime: runtimeValues(env.values),
|
|
1100
|
-
discoveryPatterns:
|
|
1101
|
-
|
|
1102
|
-
: undefined, language)),
|
|
1134
|
+
discoveryPatterns: codePatterns(resolved),
|
|
1135
|
+
blocksPattern: resolved.blocks,
|
|
1103
1136
|
language,
|
|
1104
1137
|
config: settings.config,
|
|
1105
1138
|
secretNames: new Set(Object.keys(packValues(env.values))),
|
|
@@ -1153,7 +1186,7 @@ async function walkRuntimePorts(args, inUse) {
|
|
|
1153
1186
|
exitCode: 1,
|
|
1154
1187
|
};
|
|
1155
1188
|
}
|
|
1156
|
-
|
|
1189
|
+
emitProblem(`⚠ port ${args.port} is in use (another kindgi dev?): using ${free}`);
|
|
1157
1190
|
return { kind: 'ok', port: free };
|
|
1158
1191
|
}
|
|
1159
1192
|
function resolveDevArgs(ctx) {
|
|
@@ -1330,6 +1363,24 @@ function pickRunners(ctx) {
|
|
|
1330
1363
|
exitCode: 1,
|
|
1331
1364
|
};
|
|
1332
1365
|
}
|
|
1366
|
+
/**
|
|
1367
|
+
* Write `.kindgirc.json`, readable by its owner only, since it holds the dev
|
|
1368
|
+
* token and the pack service's token: a new `0600` file that replaces the old
|
|
1369
|
+
* one (`writePrivateFile`), so a program that opened an older, looser one
|
|
1370
|
+
* can't read the new tokens through it. Whether it was written. Best effort:
|
|
1371
|
+
* what goes wrong is a warning, and boot goes on. Without the file, the CLI
|
|
1372
|
+
* in the folder can still pass --url and --token.
|
|
1373
|
+
*/
|
|
1374
|
+
async function writeKindgirc(path, rc) {
|
|
1375
|
+
try {
|
|
1376
|
+
await writePrivateFile(path, `${JSON.stringify(rc, null, 2)}\n`);
|
|
1377
|
+
}
|
|
1378
|
+
catch (err) {
|
|
1379
|
+
emitProblem(`⚠ couldn't write .kindgirc.json (${err.message}): the CLI in this folder needs --url and --token to reach this runtime`);
|
|
1380
|
+
return false;
|
|
1381
|
+
}
|
|
1382
|
+
return true;
|
|
1383
|
+
}
|
|
1333
1384
|
/**
|
|
1334
1385
|
* Read the persisted `.kindgirc.json` if present. Returns `undefined`
|
|
1335
1386
|
* for any missing field — all missing cases fall back to
|
|
@@ -1377,7 +1428,7 @@ function emitBootIndex(bootIndex, bootReport, roots) {
|
|
|
1377
1428
|
return;
|
|
1378
1429
|
}
|
|
1379
1430
|
const c = bootIndex.counts;
|
|
1380
|
-
emitProgress(`✓ loaded: ${c.tools} tools, ${c.guardrails} guardrails, ${c.agents} agents, ${c.flows} flows`);
|
|
1431
|
+
emitProgress(`✓ loaded: ${c.tools} tools, ${c.guardrails} guardrails, ${c.agents} agents, ${c.flows} flows${blocksTotal(c)}`);
|
|
1381
1432
|
for (const e of bootIndex.fileErrors) {
|
|
1382
1433
|
emitProblem(` ⚠ indexer: ${e.filePath ?? '?'} [${e.code}] ${e.message}`);
|
|
1383
1434
|
}
|
|
@@ -1410,7 +1461,7 @@ function reportWatchFailureOnce() {
|
|
|
1410
1461
|
return;
|
|
1411
1462
|
said = true;
|
|
1412
1463
|
const why = error instanceof Error ? error.message : String(error);
|
|
1413
|
-
|
|
1464
|
+
emitProblem(` ⚠ file watch failed (${why}): changes are picked up by the once-a-second scan`);
|
|
1414
1465
|
};
|
|
1415
1466
|
}
|
|
1416
1467
|
/** `fn` until the stop begins: a change seen while stopping starts nothing. */
|
|
@@ -1479,7 +1530,7 @@ async function runEach(steps) {
|
|
|
1479
1530
|
*/
|
|
1480
1531
|
function emitWatchTick(input) {
|
|
1481
1532
|
const { counts, fileErrors, failed, elapsedMs, registered, warnings } = input;
|
|
1482
|
-
const totals = `${counts.tools} tools, ${counts.guardrails} guardrails, ${counts.agents} agents, ${counts.flows} flows`;
|
|
1533
|
+
const totals = `${counts.tools} tools, ${counts.guardrails} guardrails, ${counts.agents} agents, ${counts.flows} flows${blocksTotal(counts)}`;
|
|
1483
1534
|
if (fileErrors.length === 0 && failed.length === 0) {
|
|
1484
1535
|
emitProgress(` ✓ loaded ${registered} primitives (${totals}) in ${elapsedMs}ms`);
|
|
1485
1536
|
emitWarningsSince(warnings);
|
|
@@ -1494,6 +1545,24 @@ function emitWatchTick(input) {
|
|
|
1494
1545
|
}
|
|
1495
1546
|
emitWarningsSince(warnings);
|
|
1496
1547
|
}
|
|
1548
|
+
/** `, 2 blocks` after the other counts, when the pack has any. */
|
|
1549
|
+
function blocksTotal(counts) {
|
|
1550
|
+
return counts.blocks !== undefined && counts.blocks > 0 ? `, ${counts.blocks} blocks` : '';
|
|
1551
|
+
}
|
|
1552
|
+
/**
|
|
1553
|
+
* What the blocks watcher follows: the blocks folder, templates and all.
|
|
1554
|
+
* A pattern at the pack root has no folder of its own, so it follows the
|
|
1555
|
+
* block files and, by name, the templates they name now.
|
|
1556
|
+
*/
|
|
1557
|
+
async function blocksWatch(packDir, pattern) {
|
|
1558
|
+
const folder = blocksFolder(pattern);
|
|
1559
|
+
if (folder !== '')
|
|
1560
|
+
return { patterns: [`${folder}/**`] };
|
|
1561
|
+
const matches = createGlobMatcher([pattern]);
|
|
1562
|
+
const read = await readPackBlocks(packDir, pattern);
|
|
1563
|
+
const templates = read.files.filter((rel) => !matches(rel)).map((rel) => join(packDir, rel));
|
|
1564
|
+
return { patterns: [pattern], ...(templates.length > 0 && { files: templates }) };
|
|
1565
|
+
}
|
|
1497
1566
|
/** A load's warnings, by message (an indexer that reports none, or a failed load, has none). */
|
|
1498
1567
|
function warningsOf(result) {
|
|
1499
1568
|
return new Set(result.kind === 'ok' ? (result.warnings ?? []).map((w) => w.message) : []);
|
|
@@ -1512,27 +1581,33 @@ function emitWarningsSince({ fresh, standing }) {
|
|
|
1512
1581
|
emitProblem(` ⚠ ${standing} warnings from the last load still apply`);
|
|
1513
1582
|
}
|
|
1514
1583
|
/**
|
|
1515
|
-
*
|
|
1516
|
-
*
|
|
1517
|
-
*
|
|
1518
|
-
*
|
|
1519
|
-
*
|
|
1584
|
+
* Bring the pack's framework skills up to this CLI's (`refreshSkillsForDev`),
|
|
1585
|
+
* and say what changed and what's still behind. Silent when nothing is. A
|
|
1586
|
+
* refresh that fails is said, never fails boot: the skills help the coding
|
|
1587
|
+
* agent, not the pack. What's behind, and a refresh that fails, are
|
|
1588
|
+
* warnings: shown under `--quiet` too.
|
|
1520
1589
|
*/
|
|
1521
|
-
async function
|
|
1590
|
+
async function emitSkillsRefresh(packDir, language, commands) {
|
|
1522
1591
|
const skillsRoot = defaultSdkSkillsRoot();
|
|
1523
1592
|
if (skillsRoot === undefined)
|
|
1524
1593
|
return;
|
|
1594
|
+
let lines;
|
|
1525
1595
|
try {
|
|
1526
|
-
const
|
|
1527
|
-
|
|
1528
|
-
return;
|
|
1529
|
-
emitProgress(` ⚠ Framework skills: ${drift}.`);
|
|
1530
|
-
emitProgress(` Run \`${syncCommand}\` to pull the latest.`);
|
|
1531
|
-
emitProgress('');
|
|
1596
|
+
const refresh = await refreshSkillsForDev({ skillsRoot, targetDir: packDir, language });
|
|
1597
|
+
lines = describeDevSkillsRefresh(refresh, commands);
|
|
1532
1598
|
}
|
|
1533
|
-
catch {
|
|
1534
|
-
|
|
1599
|
+
catch (error) {
|
|
1600
|
+
const why = error instanceof Error ? error.message : String(error);
|
|
1601
|
+
lines = [
|
|
1602
|
+
{ text: ` ⚠ Framework skills: couldn't refresh them: ${why}`, problem: true },
|
|
1603
|
+
{ text: ` Run \`${commands.sync}\` to pull the latest.`, problem: true },
|
|
1604
|
+
];
|
|
1535
1605
|
}
|
|
1606
|
+
if (lines.length === 0)
|
|
1607
|
+
return;
|
|
1608
|
+
for (const line of lines)
|
|
1609
|
+
(line.problem ? emitProblem : emitProgress)(line.text);
|
|
1610
|
+
(lines.some((line) => line.problem) ? emitProblem : emitProgress)('');
|
|
1536
1611
|
}
|
|
1537
1612
|
/**
|
|
1538
1613
|
* How this pack's code runs (`dev/pack-code.ts`). For a Python pack, the
|
|
@@ -1607,7 +1682,7 @@ async function settleProviderKeys(inputs) {
|
|
|
1607
1682
|
if (h.inKindgiFile)
|
|
1608
1683
|
continue;
|
|
1609
1684
|
const where = h.files.map((f) => displayEnvPath(inputs.packDir, f)).join(' and ');
|
|
1610
|
-
|
|
1685
|
+
emitProblem(` ⚠ ${h.name} is in ${where}, which your app loads too. To give Kindgi its own copy: ${inputs.kindgi('secrets', 'copy')} (it never edits your app's files).`);
|
|
1611
1686
|
}
|
|
1612
1687
|
return all;
|
|
1613
1688
|
}
|
|
@@ -1648,18 +1723,33 @@ async function applyDeclaredProviders(inputs) {
|
|
|
1648
1723
|
});
|
|
1649
1724
|
}
|
|
1650
1725
|
catch (err) {
|
|
1651
|
-
|
|
1726
|
+
emitProblem(`⚠ Providers from ${inputs.file}: not applied; the runtime's providers could not be listed: ${err.message}`);
|
|
1652
1727
|
return;
|
|
1653
1728
|
}
|
|
1654
|
-
for (const line of describeReconcile(result.outcomes, inputs))
|
|
1655
|
-
emitProgress(line);
|
|
1729
|
+
for (const line of describeReconcile(result.outcomes, inputs)) {
|
|
1730
|
+
(line.problem ? emitProblem : emitProgress)(line.text);
|
|
1731
|
+
}
|
|
1656
1732
|
try {
|
|
1657
1733
|
await writeOwnedProviders(recordPath, inputs.key, result.owned);
|
|
1658
1734
|
}
|
|
1659
1735
|
catch (err) {
|
|
1660
|
-
|
|
1736
|
+
emitProblem(` ⚠ could not write ${join('.kindgi', 'dev', 'providers.json')}: ${err.message}. The next boot leaves the providers registered now as they are.`);
|
|
1661
1737
|
}
|
|
1662
1738
|
}
|
|
1739
|
+
/**
|
|
1740
|
+
* The dev token as the banners show it: as the runtime's own startup line
|
|
1741
|
+
* does, `kgi_bt_…` and its last four characters, so a dev log someone
|
|
1742
|
+
* pastes doesn't give the token away. A token pinned with `--dev-token` in
|
|
1743
|
+
* another shape shows only its last four, and none under 16 characters.
|
|
1744
|
+
* `tokenFile`, in the pack, has it in full.
|
|
1745
|
+
*/
|
|
1746
|
+
export function describeDevToken(token, tokenFile) {
|
|
1747
|
+
const scrubbed = scrubText(token);
|
|
1748
|
+
const shown = /^kgi_[a-z]{2,3}_…[^…]{0,4}$/u.test(scrubbed)
|
|
1749
|
+
? scrubbed
|
|
1750
|
+
: `…${token.length >= 16 ? token.slice(-4) : ''}`;
|
|
1751
|
+
return `${shown} (in full in the pack's ${tokenFile})`;
|
|
1752
|
+
}
|
|
1663
1753
|
/** The browser origins line: who may follow runs with public run tokens (`KINDGI_CORS_ORIGINS`). */
|
|
1664
1754
|
function describeBrowserOrigins(origins) {
|
|
1665
1755
|
return origins.length > 0
|
|
@@ -1700,7 +1790,7 @@ export function renderDevBanner(inputs) {
|
|
|
1700
1790
|
}
|
|
1701
1791
|
lines.push(` API server ${inputs.baseUrl}`);
|
|
1702
1792
|
lines.push(` Tenant ${inputs.tenantId}`);
|
|
1703
|
-
lines.push(` Bearer token ${inputs.token}`);
|
|
1793
|
+
lines.push(` Bearer token ${describeDevToken(inputs.token, inputs.tokenFile)}`);
|
|
1704
1794
|
lines.push(` Pack dir ${inputs.packDir}`);
|
|
1705
1795
|
if (inputs.providers !== undefined) {
|
|
1706
1796
|
lines.push(` Models ${describeModels(inputs.providers)}`);
|
|
@@ -1727,7 +1817,7 @@ function renderIndexSection(inputs) {
|
|
|
1727
1817
|
const c = index.counts;
|
|
1728
1818
|
const lines = [
|
|
1729
1819
|
` Discovering pack (${index.packId}@${index.packVersion})`,
|
|
1730
|
-
` ✓ ${c.tools} tools ✓ ${c.guardrails} guardrails ✓ ${c.agents} agents ✓ ${c.flows} flows`,
|
|
1820
|
+
` ✓ ${c.tools} tools ✓ ${c.guardrails} guardrails ✓ ${c.agents} agents ✓ ${c.flows} flows${c.blocks !== undefined && c.blocks > 0 ? ` ✓ ${c.blocks} blocks` : ''}`,
|
|
1731
1821
|
];
|
|
1732
1822
|
if (inputs.bootReport.failed.length > 0) {
|
|
1733
1823
|
lines.push('', ' Registration failures:');
|