argsbarg 6.1.5 → 6.1.7
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/CHANGELOG.md +15 -3
- package/docs/http-server.md +3 -3
- package/examples/full-example/docs/cli-schema.json +9 -9
- package/examples/full-example/docs/cli.md +9 -9
- package/examples/full-example/docs/http.md +3 -3
- package/examples/full-example/docs/openapi.json +6 -35
- package/package.json +1 -1
- package/src/builtins/builtins.test.ts +4 -4
- package/src/builtins/completion-bash.ts +1 -1
- package/src/builtins/completion-fish.ts +1 -1
- package/src/builtins/completion-group.ts +3 -3
- package/src/builtins/completion-zsh.ts +1 -1
- package/src/builtins/config.test.ts +3 -3
- package/src/builtins/config.ts +9 -9
- package/src/builtins/configure-copy.ts +2 -2
- package/src/builtins/configure.ts +3 -3
- package/src/builtins/dispatch.ts +10 -10
- package/src/builtins/export.ts +4 -4
- package/src/builtins/http.ts +6 -6
- package/src/builtins/mcp.ts +3 -3
- package/src/builtins/presentation.ts +5 -5
- package/src/builtins/registry.ts +3 -3
- package/src/builtins/scopes.ts +2 -2
- package/src/builtins/version.ts +1 -1
- package/src/cli-tool/full-example-capabilities.test.ts +2 -2
- package/src/cli-tool/main.ts +1 -1
- package/src/cli-tool/program.ts +1 -1
- package/src/cli-tool/prompt.ts +1 -1
- package/src/config/bindings.test.ts +1 -1
- package/src/config/bindings.ts +1 -1
- package/src/config/bootstrap.test.ts +1 -1
- package/src/config/bootstrap.ts +3 -3
- package/src/config/context.test.ts +1 -1
- package/src/config/context.ts +1 -1
- package/src/config/entry.ts +1 -1
- package/src/config/file.test.ts +1 -1
- package/src/config/file.ts +3 -3
- package/src/config/manifest.ts +1 -1
- package/src/config/resolve.test.ts +1 -1
- package/src/config/resolve.ts +1 -1
- package/src/config/schema.ts +1 -1
- package/src/config/validate.ts +1 -1
- package/src/configure/artifacts/binary-placement.test.ts +1 -1
- package/src/configure/artifacts/binary-placement.ts +1 -1
- package/src/configure/artifacts/gh-release-update.ts +1 -1
- package/src/configure/artifacts/install-validate.test.ts +3 -3
- package/src/configure/artifacts/mcp-config.ts +1 -1
- package/src/configure/artifacts/mcp-opencode.test.ts +1 -1
- package/src/configure/artifacts/mcp-opencode.ts +1 -1
- package/src/configure/artifacts/paths.ts +5 -5
- package/src/configure/artifacts/plan.ts +1 -1
- package/src/configure/artifacts/status.test.ts +1 -1
- package/src/configure/artifacts/status.ts +2 -2
- package/src/configure/artifacts/target-base.ts +1 -1
- package/src/configure/artifacts/target-detect.ts +1 -1
- package/src/configure/artifacts/target-effective.ts +3 -3
- package/src/configure/artifacts/target-mcp-cli.ts +1 -1
- package/src/configure/artifacts/target-mcp-json.ts +1 -1
- package/src/configure/artifacts/target-plan-build.ts +2 -2
- package/src/configure/artifacts/target-scope.ts +3 -3
- package/src/configure/artifacts/target-skill.ts +1 -1
- package/src/configure/artifacts/target-types.ts +2 -2
- package/src/configure/artifacts/targets/app.ts +5 -5
- package/src/configure/artifacts/targets/chatgpt-mcp.ts +2 -2
- package/src/configure/artifacts/targets/claude-code-mcp.ts +2 -2
- package/src/configure/artifacts/targets/claude-desktop-mcp.ts +2 -2
- package/src/configure/artifacts/targets/claude-skill.ts +2 -2
- package/src/configure/artifacts/targets/codex-mcp.ts +2 -2
- package/src/configure/artifacts/targets/codex-skill.ts +2 -2
- package/src/configure/artifacts/targets/configure.ts +5 -5
- package/src/configure/artifacts/targets/cursor-mcp.ts +2 -2
- package/src/configure/artifacts/targets/cursor-skill.ts +2 -2
- package/src/configure/artifacts/targets/index.ts +1 -1
- package/src/configure/artifacts/targets/openclaw-mcp.ts +2 -2
- package/src/configure/artifacts/targets/openclaw-skill.ts +3 -3
- package/src/configure/artifacts/targets/opencode-mcp.ts +5 -5
- package/src/configure/artifacts/targets/opencode-skill.ts +3 -3
- package/src/configure/artifacts/targets.test.ts +1 -1
- package/src/configure/artifacts/uninstall.ts +1 -1
- package/src/configure/configure.test.ts +9 -9
- package/src/configure/index.ts +5 -5
- package/src/configure/prompt.ts +1 -1
- package/src/core/context.ts +3 -3
- package/src/core/json-leaf.test.ts +1 -1
- package/src/core/leaf-inputs.test.ts +1 -1
- package/src/core/leaf-inputs.ts +2 -2
- package/src/core/parse.test.ts +9 -9
- package/src/core/parse.ts +2 -2
- package/src/core/schema.ts +3 -3
- package/src/core/types.ts +1 -1
- package/src/core/validate.ts +6 -6
- package/src/docs/builtin.ts +3 -3
- package/src/docs/cli-guide.test.ts +3 -3
- package/src/docs/cli-guide.ts +5 -5
- package/src/docs/docs.test.ts +8 -8
- package/src/docs/http-guide.ts +10 -10
- package/src/docs/mcp-guide.ts +7 -7
- package/src/docs/mcp-resources.test.ts +1 -1
- package/src/docs/mcp-resources.ts +1 -1
- package/src/docs/resolve.ts +4 -4
- package/src/docs/save.ts +2 -2
- package/src/exports/cli.ts +9 -9
- package/src/exports/headless.ts +2 -2
- package/src/exports/http.ts +2 -2
- package/src/exports/mcp.ts +2 -2
- package/src/headless/routing.ts +2 -2
- package/src/headless/tool-call.ts +11 -11
- package/src/hooks/run.ts +6 -6
- package/src/http/openapi.ts +23 -15
- package/src/http/paths.ts +1 -1
- package/src/http/readiness.ts +3 -3
- package/src/http/result.ts +1 -1
- package/src/http/routes.ts +4 -4
- package/src/http/server.ts +7 -7
- package/src/log/emitter.ts +1 -1
- package/src/mcp/bundle.ts +2 -2
- package/src/mcp/claude.test.ts +1 -1
- package/src/mcp/claude.ts +4 -4
- package/src/mcp/hidden-mcpb.test.ts +5 -5
- package/src/mcp/result.ts +2 -2
- package/src/mcp/server.ts +3 -3
- package/src/mcp/tools.ts +7 -7
- package/src/runtime/capabilities.ts +2 -2
- package/src/runtime/cli-errors.ts +3 -3
- package/src/runtime/cli.ts +22 -22
- package/src/runtime/exposure.ts +2 -2
- package/src/runtime/invoke.test.ts +6 -6
- package/src/server/context.ts +3 -3
- package/src/server/overrides.ts +3 -3
- package/src/skill/generate.ts +5 -5
- package/src/skill/hint.ts +1 -1
- package/src/skill/install.ts +2 -2
- package/src/skill/naming.ts +1 -1
- package/src/test/fixtures.ts +2 -2
- package/src/test/integration/config.test.ts +3 -3
- package/src/test/integration/http.test.ts +18 -14
- package/src/test/integration/mcp.test.ts +6 -6
|
@@ -6,15 +6,9 @@ import { afterEach, beforeEach, describe, expect, test } from "bun:test";
|
|
|
6
6
|
import { existsSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { tmpdir } from "node:os";
|
|
8
8
|
import { join } from "node:path";
|
|
9
|
-
import { appConfigFileExists } from "
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
formatConfigureMutationSummary,
|
|
13
|
-
parseConfigureOpts,
|
|
14
|
-
validateConfigureOpts,
|
|
15
|
-
} from "~/configure";
|
|
16
|
-
import type { CliProgram } from "~/core/types.ts";
|
|
17
|
-
import { Cli } from "~/index";
|
|
9
|
+
import { appConfigFileExists } from "../config/file.ts";
|
|
10
|
+
import type { CliProgram } from "../core/types.ts";
|
|
11
|
+
import { Cli } from "../index.ts";
|
|
18
12
|
import { detectInstalledArtifacts } from "./artifacts/detect-installed.ts";
|
|
19
13
|
import { parseInstallOpts } from "./artifacts/opts.ts";
|
|
20
14
|
import { resolveClaudeDesktopMcpPath, resolveInstallPaths } from "./artifacts/paths.ts";
|
|
@@ -22,6 +16,12 @@ import { buildInstallPlan, buildUpdatePlan } from "./artifacts/plan.ts";
|
|
|
22
16
|
import { installTargetForKey } from "./artifacts/target-registry.ts";
|
|
23
17
|
import { buildDetectedSnapshot, buildTargetPlanContext } from "./artifacts/target-scope.ts";
|
|
24
18
|
import { buildUninstallPlan } from "./artifacts/uninstall.ts";
|
|
19
|
+
import {
|
|
20
|
+
appConfigHasEntries,
|
|
21
|
+
formatConfigureMutationSummary,
|
|
22
|
+
parseConfigureOpts,
|
|
23
|
+
validateConfigureOpts,
|
|
24
|
+
} from "./index.ts";
|
|
25
25
|
|
|
26
26
|
const fixture: CliProgram = {
|
|
27
27
|
key: "testapp",
|
package/src/configure/index.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Interactive and automated `configure` command orchestration (agent artifacts and app config).
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { displayAppConfigPath, runConfigure } from "
|
|
6
|
-
import { ensureAppConfigFile } from "
|
|
7
|
-
import type { CliProgram } from "
|
|
8
|
-
import { resolveCapabilities } from "
|
|
9
|
-
import { cliSkillInstall, skillTargetFromActionKind } from "
|
|
5
|
+
import { displayAppConfigPath, runConfigure } from "../config/bootstrap.ts";
|
|
6
|
+
import { ensureAppConfigFile } from "../config/file.ts";
|
|
7
|
+
import type { CliProgram } from "../core/types.ts";
|
|
8
|
+
import { resolveCapabilities } from "../runtime/capabilities.ts";
|
|
9
|
+
import { cliSkillInstall, skillTargetFromActionKind } from "../skill/install.ts";
|
|
10
10
|
import { resolveInstallPaths } from "./artifacts/paths.ts";
|
|
11
11
|
import { buildInstallPlan, buildUpdatePlan } from "./artifacts/plan.ts";
|
|
12
12
|
import {
|
package/src/configure/prompt.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
TTY prompts for per-target install, skip, or uninstall during interactive `configure`.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { readPromptLine } from "
|
|
5
|
+
import { readPromptLine } from "../prompt.ts";
|
|
6
6
|
import type { CliInstallArtifactKey } from "./artifacts/target-types.ts";
|
|
7
7
|
|
|
8
8
|
/** Human-readable labels for each install artifact key in interactive prompts. */
|
package/src/core/context.ts
CHANGED
|
@@ -7,9 +7,9 @@ It keeps handlers small with a typed read API for flags, strings, numbers, and c
|
|
|
7
7
|
parsed values.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import type { AnyAppConfigSnapshot } from "
|
|
11
|
-
import { EmptyAppConfigSnapshot } from "
|
|
12
|
-
import { strictParseDouble } from "
|
|
10
|
+
import type { AnyAppConfigSnapshot } from "../config/context.ts";
|
|
11
|
+
import { EmptyAppConfigSnapshot } from "../config/context.ts";
|
|
12
|
+
import { strictParseDouble } from "../utils.ts";
|
|
13
13
|
import { parseCommaList, parseDate, parseDateTime, parseDurationMs } from "./formats.ts";
|
|
14
14
|
import { loadLeafInputs, readJsonOptionValue } from "./leaf-inputs.ts";
|
|
15
15
|
import { normalizeRespondOptions, writeRespondBodyToStdout } from "./respond.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import { Cli } from "
|
|
2
|
+
import { Cli } from "../index.ts";
|
|
3
3
|
import { ParseKind, parse } from "./parse.ts";
|
|
4
4
|
import { CliOptionKind, type CliProgram, CliSchemaValidationError } from "./types.ts";
|
|
5
5
|
import { cliValidateProgram } from "./validate.ts";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, test } from "bun:test";
|
|
2
|
-
import { Cli, CliContext, CliOptionKind } from "
|
|
2
|
+
import { Cli, CliContext, CliOptionKind } from "../index.ts";
|
|
3
3
|
import { LeafInputError, loadLeafInputs } from "./leaf-inputs.ts";
|
|
4
4
|
import type { CliProgram } from "./types.ts";
|
|
5
5
|
|
package/src/core/leaf-inputs.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Leaf input reads: Json options (flag, preloaded stdin, or toolArgs), optional inputSchema validation.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { validateConfigDocument } from "
|
|
6
|
-
import { isInteractiveTty } from "
|
|
5
|
+
import { validateConfigDocument } from "../config/validate.ts";
|
|
6
|
+
import { isInteractiveTty } from "../utils.ts";
|
|
7
7
|
import type { CliContext, CliLeafInputs } from "./context.ts";
|
|
8
8
|
import { collectOptionDefs } from "./parse.ts";
|
|
9
9
|
import type { CliInvocation, CliLeaf, CliNode, CliOption, CliProgram } from "./types.ts";
|
package/src/core/parse.test.ts
CHANGED
|
@@ -7,21 +7,21 @@ import { existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "no
|
|
|
7
7
|
import { tmpdir } from "node:os";
|
|
8
8
|
import { join } from "node:path";
|
|
9
9
|
import { $ } from "bun";
|
|
10
|
-
import { completionBashScript, completionZshScript } from "
|
|
11
|
-
import { cliPresentationRoot } from "
|
|
12
|
-
import { cliHelpRender } from "
|
|
13
|
-
import { Cli, CliFallbackMode, CliOptionKind, type CliProgram } from "
|
|
14
|
-
import { applyShellEnv } from "
|
|
15
|
-
import { allMcpResources, collectMcpTools, mcpToolCallToArgv, resolveMcpSchemaUri } from "
|
|
16
|
-
import { generatePluginSkillBundle, generateSkillBundle } from "
|
|
17
|
-
import { cliSkillInstall } from "
|
|
10
|
+
import { completionBashScript, completionZshScript } from "../builtins/index.ts";
|
|
11
|
+
import { cliPresentationRoot } from "../builtins/presentation.ts";
|
|
12
|
+
import { cliHelpRender } from "../help.ts";
|
|
13
|
+
import { Cli, CliFallbackMode, CliOptionKind, type CliProgram } from "../index.ts";
|
|
14
|
+
import { applyShellEnv } from "../mcp/env.ts";
|
|
15
|
+
import { allMcpResources, collectMcpTools, mcpToolCallToArgv, resolveMcpSchemaUri } from "../mcp/tools.ts";
|
|
16
|
+
import { generatePluginSkillBundle, generateSkillBundle } from "../skill/generate.ts";
|
|
17
|
+
import { cliSkillInstall } from "../skill/install.ts";
|
|
18
18
|
import {
|
|
19
19
|
enumMcpFixture,
|
|
20
20
|
nestedDocsFallbackFixture,
|
|
21
21
|
nestedMcpFixture,
|
|
22
22
|
testProgram,
|
|
23
23
|
varargsReadFixture,
|
|
24
|
-
} from "
|
|
24
|
+
} from "../test/fixtures.ts";
|
|
25
25
|
import { ParseKind, parse, postParseValidate } from "./parse.ts";
|
|
26
26
|
import { cliSchemaJson } from "./schema.ts";
|
|
27
27
|
import { cliValidateProgram } from "./validate.ts";
|
package/src/core/parse.ts
CHANGED
|
@@ -7,8 +7,8 @@ It keeps handler dispatch and help on one parser so the CLI behavior stays consi
|
|
|
7
7
|
across every entry path.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
import { isCliCallable } from "
|
|
11
|
-
import { fullStringIsDouble } from "
|
|
10
|
+
import { isCliCallable } from "../runtime/exposure.ts";
|
|
11
|
+
import { fullStringIsDouble } from "../utils.ts";
|
|
12
12
|
import { formatValidationError, validateFormatValue } from "./formats.ts";
|
|
13
13
|
import {
|
|
14
14
|
CliFallbackMode,
|
package/src/core/schema.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
This module serializes the CLI schema tree to JSON for machine-readable introspection.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { type CliSchemaExport, exportPresentationBuiltins } from "
|
|
6
|
-
import { cliResolveNotes } from "
|
|
7
|
-
import { isCliSchemaHidden, visibleOptions } from "
|
|
5
|
+
import { type CliSchemaExport, exportPresentationBuiltins } from "../builtins/export.ts";
|
|
6
|
+
import { cliResolveNotes } from "../help.ts";
|
|
7
|
+
import { isCliSchemaHidden, visibleOptions } from "../runtime/exposure.ts";
|
|
8
8
|
import { type CliNode, type CliProgram, isCliLeaf, isCliRouter, leafOutputSchema } from "./types.ts";
|
|
9
9
|
|
|
10
10
|
const RESERVED = new Set(["http", "completion", "configure", "docs", "mcp", "version"]);
|
package/src/core/types.ts
CHANGED
|
@@ -4,7 +4,7 @@ It is the shared declarative model that parsing, validation, help, and completio
|
|
|
4
4
|
read from, so the package has one source of truth.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { AnyAppConfigSnapshot } from "
|
|
7
|
+
import type { AnyAppConfigSnapshot } from "../config/context.ts";
|
|
8
8
|
import type { CliContext } from "./context.ts";
|
|
9
9
|
|
|
10
10
|
/**
|
package/src/core/validate.ts
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
This module validates CLI schemas before execution.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { AGENT_PAIRS, MCP_KEYS, mcpServerRequiredForArtifact } from "
|
|
6
|
-
import { reservedDocsTopicResourceUris } from "
|
|
7
|
-
import { DOCS_BUILTIN_TOPIC_KEYS, docsEnabled } from "
|
|
8
|
-
import { HTTP_RESERVED_TOP_LEVEL_SEGMENTS } from "
|
|
9
|
-
import { resolveMcpSchemaUri } from "
|
|
10
|
-
import { reservedCommandNames, resolveCapabilities } from "
|
|
5
|
+
import { AGENT_PAIRS, MCP_KEYS, mcpServerRequiredForArtifact } from "../configure/artifacts/target-registry.ts";
|
|
6
|
+
import { reservedDocsTopicResourceUris } from "../docs/mcp-resources.ts";
|
|
7
|
+
import { DOCS_BUILTIN_TOPIC_KEYS, docsEnabled } from "../docs/resolve.ts";
|
|
8
|
+
import { HTTP_RESERVED_TOP_LEVEL_SEGMENTS } from "../http/paths.ts";
|
|
9
|
+
import { resolveMcpSchemaUri } from "../mcp/tools.ts";
|
|
10
|
+
import { reservedCommandNames, resolveCapabilities } from "../runtime/capabilities.ts";
|
|
11
11
|
import { validateFormatValue } from "./formats.ts";
|
|
12
12
|
import {
|
|
13
13
|
type CliLeaf,
|
package/src/docs/builtin.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { docsSkillTopicDescription } from "
|
|
2
|
-
import { type CliLeaf, type CliOption, CliOptionKind, type CliProgram, type CliRouter } from "
|
|
3
|
-
import { resolveCapabilities } from "
|
|
1
|
+
import { docsSkillTopicDescription } from "../builtins/configure-copy.ts";
|
|
2
|
+
import { type CliLeaf, type CliOption, CliOptionKind, type CliProgram, type CliRouter } from "../core/types.ts";
|
|
3
|
+
import { resolveCapabilities } from "../runtime/capabilities.ts";
|
|
4
4
|
import {
|
|
5
5
|
DOCS_ROUTER_DESCRIPTION,
|
|
6
6
|
docsEnabled,
|
|
@@ -3,9 +3,9 @@ Tests for docs/cli-guide module behavior.
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import { expect, test } from "bun:test";
|
|
6
|
-
import { cliSchemaExport } from "
|
|
7
|
-
import type { CliProgram } from "
|
|
8
|
-
import { CliOptionKind } from "
|
|
6
|
+
import { cliSchemaExport } from "../core/schema.ts";
|
|
7
|
+
import type { CliProgram } from "../core/types.ts";
|
|
8
|
+
import { CliOptionKind } from "../core/types.ts";
|
|
9
9
|
import { generateCliGuide, generateCliGuideBody } from "./cli-guide.ts";
|
|
10
10
|
|
|
11
11
|
const nestedFixture: CliProgram = {
|
package/src/docs/cli-guide.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { CliSchemaExport } from "
|
|
2
|
-
import { cliSchemaExport } from "
|
|
3
|
-
import type { CliOption, CliPositional, CliProgram } from "
|
|
4
|
-
import { CliFallbackMode, CliOptionKind } from "
|
|
5
|
-
import { cliPositionalLabel, cliResolveNotes } from "
|
|
1
|
+
import type { CliSchemaExport } from "../builtins/export.ts";
|
|
2
|
+
import { cliSchemaExport } from "../core/schema.ts";
|
|
3
|
+
import type { CliOption, CliPositional, CliProgram } from "../core/types.ts";
|
|
4
|
+
import { CliFallbackMode, CliOptionKind } from "../core/types.ts";
|
|
5
|
+
import { cliPositionalLabel, cliResolveNotes } from "../help.ts";
|
|
6
6
|
|
|
7
7
|
/** Options for {@link generateCliGuideBody} and {@link generateCliGuide}. */
|
|
8
8
|
export interface CliGuideBodyOptions {
|
package/src/docs/docs.test.ts
CHANGED
|
@@ -6,14 +6,14 @@ import { afterEach, beforeEach, expect, test } from "bun:test";
|
|
|
6
6
|
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
|
7
7
|
import { tmpdir } from "node:os";
|
|
8
8
|
import { join } from "node:path";
|
|
9
|
-
import { completionBashScript } from "
|
|
10
|
-
import { cliPresentationRoot } from "
|
|
11
|
-
import { ParseKind, parse } from "
|
|
12
|
-
import type { CliProgram } from "
|
|
13
|
-
import { cliValidateProgram } from "
|
|
14
|
-
import { cliHelpRender } from "
|
|
15
|
-
import { Cli } from "
|
|
16
|
-
import { resolveCapabilities, skipsRequiredAppConfigExit } from "
|
|
9
|
+
import { completionBashScript } from "../builtins/index.ts";
|
|
10
|
+
import { cliPresentationRoot } from "../builtins/presentation.ts";
|
|
11
|
+
import { ParseKind, parse } from "../core/parse.ts";
|
|
12
|
+
import type { CliProgram } from "../core/types.ts";
|
|
13
|
+
import { cliValidateProgram } from "../core/validate.ts";
|
|
14
|
+
import { cliHelpRender } from "../help.ts";
|
|
15
|
+
import { Cli } from "../index.ts";
|
|
16
|
+
import { resolveCapabilities, skipsRequiredAppConfigExit } from "../runtime/capabilities.ts";
|
|
17
17
|
import { generateMcpGuide } from "./mcp-guide.ts";
|
|
18
18
|
import { saveDocsTopic } from "./save.ts";
|
|
19
19
|
|
package/src/docs/http-guide.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defaultConfigEntryTitle } from "
|
|
2
|
-
import { displayAppConfigPath } from "
|
|
3
|
-
import { collectOptionDefs } from "
|
|
4
|
-
import { CliOptionKind, type CliProgram } from "
|
|
5
|
-
import { httpUserPathGlob, resolveHttpPathPrefix } from "
|
|
6
|
-
import { collectHttpRoutes } from "
|
|
7
|
-
import { resolveHttpListenAddress } from "
|
|
1
|
+
import { defaultConfigEntryTitle } from "../config/entry.ts";
|
|
2
|
+
import { displayAppConfigPath } from "../config/file.ts";
|
|
3
|
+
import { collectOptionDefs } from "../core/parse.ts";
|
|
4
|
+
import { CliOptionKind, type CliProgram } from "../core/types.ts";
|
|
5
|
+
import { httpUserPathGlob, resolveHttpPathPrefix } from "../http/paths.ts";
|
|
6
|
+
import { collectHttpRoutes } from "../http/routes.ts";
|
|
7
|
+
import { resolveHttpListenAddress } from "../http/server.ts";
|
|
8
8
|
|
|
9
9
|
/** Formats one HTTP route for the auto-generated HTTP guide. */
|
|
10
10
|
function formatRouteLine(root: CliProgram, route: ReturnType<typeof collectHttpRoutes>[number]): string {
|
|
@@ -51,8 +51,8 @@ export function generateHttpGuide(root: CliProgram): string {
|
|
|
51
51
|
"",
|
|
52
52
|
"| Method | Path | Purpose |",
|
|
53
53
|
"| --- | --- | --- |",
|
|
54
|
-
"| `GET` | `/health
|
|
55
|
-
"| `GET` | `/health/readiness` | Readiness
|
|
54
|
+
"| `GET` | `/health/liveness` | Liveness — server is online and accepting requests |",
|
|
55
|
+
"| `GET` | `/health/readiness` | Readiness — online plus config and `program.readiness` checks passed |",
|
|
56
56
|
"| `GET` | `/openapi.json` | OpenAPI 3.1 REST paths |",
|
|
57
57
|
"| `GET` | `/swagger` | Interactive Swagger UI API reference |",
|
|
58
58
|
`| * | \`${userGlob}\` | Invoke user commands (method per route) |`,
|
|
@@ -63,7 +63,7 @@ export function generateHttpGuide(root: CliProgram): string {
|
|
|
63
63
|
"## Examples",
|
|
64
64
|
"",
|
|
65
65
|
"```bash",
|
|
66
|
-
`curl -s ${baseUrl}/health`,
|
|
66
|
+
`curl -s ${baseUrl}/health/liveness`,
|
|
67
67
|
`curl -s ${baseUrl}/health/readiness`,
|
|
68
68
|
`curl -s ${baseUrl}/openapi.json`,
|
|
69
69
|
`curl -s ${baseUrl}${sampleWorkspaces}`,
|
package/src/docs/mcp-guide.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defaultConfigEntryTitle } from "
|
|
2
|
-
import { displayAppConfigPath } from "
|
|
3
|
-
import { expectedOpenCodeMcpEntry, OPENCODE_CONFIG_SCHEMA } from "
|
|
4
|
-
import { collectOptionDefs } from "
|
|
5
|
-
import { CliOptionKind, type CliProgram } from "
|
|
6
|
-
import { collectMcpTools, type McpToolDef, mcpServerId, resolveMcpSchemaUri } from "
|
|
7
|
-
import { resolveCapabilities } from "
|
|
1
|
+
import { defaultConfigEntryTitle } from "../config/entry.ts";
|
|
2
|
+
import { displayAppConfigPath } from "../config/file.ts";
|
|
3
|
+
import { expectedOpenCodeMcpEntry, OPENCODE_CONFIG_SCHEMA } from "../configure/artifacts/mcp-opencode.ts";
|
|
4
|
+
import { collectOptionDefs } from "../core/parse.ts";
|
|
5
|
+
import { CliOptionKind, type CliProgram } from "../core/types.ts";
|
|
6
|
+
import { collectMcpTools, type McpToolDef, mcpServerId, resolveMcpSchemaUri } from "../mcp/tools.ts";
|
|
7
|
+
import { resolveCapabilities } from "../runtime/capabilities.ts";
|
|
8
8
|
import { resolveDocsTopicResourceUri } from "./mcp-resources.ts";
|
|
9
9
|
import { docsEnabled, docsUserTopicKeys, resolveDocsConfig } from "./resolve.ts";
|
|
10
10
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Auto MCP resources for user docs.topics when docs and MCP are both enabled.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { CliProgram } from "
|
|
5
|
+
import type { CliProgram } from "../core/types.ts";
|
|
6
6
|
import { docsEnabled, docsTopicDescription, docsTopicText, docsUserTopicKeys, resolveDocsConfig } from "./resolve.ts";
|
|
7
7
|
|
|
8
8
|
/** Default URI pattern for a docs topic MCP resource (`<mcpId>://docs/<topicKey>`). */
|
package/src/docs/resolve.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { cliSchemaJson } from "
|
|
2
|
-
import type { CliDocsConfig, CliProgram } from "
|
|
3
|
-
import { openApiJson } from "
|
|
4
|
-
import { generateSkillBundle } from "
|
|
1
|
+
import { cliSchemaJson } from "../core/schema.ts";
|
|
2
|
+
import type { CliDocsConfig, CliProgram } from "../core/types.ts";
|
|
3
|
+
import { openApiJson } from "../http/openapi.ts";
|
|
4
|
+
import { generateSkillBundle } from "../skill/generate.ts";
|
|
5
5
|
import { generateCliGuide } from "./cli-guide.ts";
|
|
6
6
|
import { generateHttpGuide } from "./http-guide.ts";
|
|
7
7
|
import { generateMcpGuide } from "./mcp-guide.ts";
|
package/src/docs/save.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import type { CliProgram } from "
|
|
4
|
-
import { generatedFileHtmlComment, insertGeneratedHint } from "
|
|
3
|
+
import type { CliProgram } from "../core/types.ts";
|
|
4
|
+
import { generatedFileHtmlComment, insertGeneratedHint } from "../skill/hint.ts";
|
|
5
5
|
import { docsTopicContent } from "./resolve.ts";
|
|
6
6
|
|
|
7
7
|
/** Relative output directory for `docs --save`. */
|
package/src/exports/cli.ts
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
Public CLI runtime export (`argsbarg/cli`).
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
export { displayAppConfigPath, resolveAppConfigPath } from "
|
|
6
|
-
export type { CliLeafInputs } from "
|
|
7
|
-
export { CliContext } from "
|
|
5
|
+
export { displayAppConfigPath, resolveAppConfigPath } from "../config/file.ts";
|
|
6
|
+
export type { CliLeafInputs } from "../core/context.ts";
|
|
7
|
+
export { CliContext } from "../core/context.ts";
|
|
8
8
|
export {
|
|
9
9
|
parseCommaList,
|
|
10
10
|
parseDate,
|
|
11
11
|
parseDateTime,
|
|
12
12
|
parseDurationMs,
|
|
13
|
-
} from "
|
|
13
|
+
} from "../core/formats.ts";
|
|
14
14
|
export type {
|
|
15
15
|
CliAppConfig,
|
|
16
16
|
CliAppConfigEntry,
|
|
@@ -35,13 +35,13 @@ export type {
|
|
|
35
35
|
InstallAgentIntegration,
|
|
36
36
|
InstallTargetSpec,
|
|
37
37
|
ResolvedInstallTarget,
|
|
38
|
-
} from "
|
|
38
|
+
} from "../core/types.ts";
|
|
39
39
|
export {
|
|
40
40
|
CliOptionKind,
|
|
41
41
|
CliSchemaValidationError,
|
|
42
42
|
CliValueFormat,
|
|
43
43
|
isJsonLeaf,
|
|
44
|
-
} from "
|
|
45
|
-
export { Cli, type CliInvokeKind, type CliInvokeResult } from "
|
|
46
|
-
export { cliErrWithHelp } from "
|
|
47
|
-
export { isInteractiveTty } from "
|
|
44
|
+
} from "../core/types.ts";
|
|
45
|
+
export { Cli, type CliInvokeKind, type CliInvokeResult } from "../runtime/cli.ts";
|
|
46
|
+
export { cliErrWithHelp } from "../runtime/cli-errors.ts";
|
|
47
|
+
export { isInteractiveTty } from "../utils.ts";
|
package/src/exports/headless.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Headless routing helpers (`argsbarg/headless`).
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
export type { HeadlessContext } from "
|
|
5
|
+
export type { HeadlessContext } from "../headless/routing.ts";
|
|
6
6
|
export {
|
|
7
7
|
formatDryRunMessage,
|
|
8
8
|
requireYesInNonTty,
|
|
@@ -10,4 +10,4 @@ export {
|
|
|
10
10
|
shouldRunHeadlessWithPositionals,
|
|
11
11
|
shouldRunHeadlessWithYes,
|
|
12
12
|
wantsExplicitJson,
|
|
13
|
-
} from "
|
|
13
|
+
} from "../headless/routing.ts";
|
package/src/exports/http.ts
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
HTTP/OpenAPI export (`argsbarg/http`).
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
export { generateOpenApi, openApiJson } from "
|
|
6
|
-
export { handleApiRequest, httpServeHttp, resolveHttpListenAddress } from "
|
|
5
|
+
export { generateOpenApi, openApiJson } from "../http/openapi.ts";
|
|
6
|
+
export { handleApiRequest, httpServeHttp, resolveHttpListenAddress } from "../http/server.ts";
|
package/src/exports/mcp.ts
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
MCP bundle export (`argsbarg/mcp`). @experimental
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
export type { McpBundlePaths, PackMcpBundleOpts } from "
|
|
6
|
-
export { defaultMcpBundlePaths, generateMcpManifest, packMcpBundle } from "
|
|
5
|
+
export type { McpBundlePaths, PackMcpBundleOpts } from "../mcp/bundle.ts";
|
|
6
|
+
export { defaultMcpBundlePaths, generateMcpManifest, packMcpBundle } from "../mcp/bundle.ts";
|
package/src/headless/routing.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CliContext } from "
|
|
2
|
-
import { isInteractiveTty } from "
|
|
1
|
+
import type { CliContext } from "../core/context.ts";
|
|
2
|
+
import { isInteractiveTty } from "../utils.ts";
|
|
3
3
|
|
|
4
4
|
/** Minimal context for headless routing helpers. */
|
|
5
5
|
export type HeadlessContext = Pick<CliContext, "invocation">;
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
Shared headless tool dispatch for MCP and HTTP: config bootstrap, argv conversion, and invoke.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { bootstrapAppConfig } from "
|
|
6
|
-
import { formatMcpMissingConfigMessage, missingRequiredConfig } from "
|
|
7
|
-
import type { CliInvocation, CliProgram, InvokeFailureKind } from "
|
|
8
|
-
import { failureKindHttpStatus } from "
|
|
9
|
-
import { apiErrorResponse, apiSuccessResponse, firstErrorLine } from "
|
|
10
|
-
import { type HttpRouteDef, httpRequestToArgv } from "
|
|
11
|
-
import { obscureUnexpectedClientMessage } from "
|
|
12
|
-
import { buildToolCallSuccessFromResponse } from "
|
|
13
|
-
import { collectMcpTools, type McpToolDef, mcpToolCallToArgv } from "
|
|
14
|
-
import type { Cli, CliInvokeResult } from "
|
|
5
|
+
import { bootstrapAppConfig } from "../config/bootstrap.ts";
|
|
6
|
+
import { formatMcpMissingConfigMessage, missingRequiredConfig } from "../config/resolve.ts";
|
|
7
|
+
import type { CliInvocation, CliProgram, InvokeFailureKind } from "../core/types.ts";
|
|
8
|
+
import { failureKindHttpStatus } from "../hooks/run.ts";
|
|
9
|
+
import { apiErrorResponse, apiSuccessResponse, firstErrorLine } from "../http/result.ts";
|
|
10
|
+
import { type HttpRouteDef, httpRequestToArgv } from "../http/routes.ts";
|
|
11
|
+
import { obscureUnexpectedClientMessage } from "../log/emitter.ts";
|
|
12
|
+
import { buildToolCallSuccessFromResponse } from "../mcp/result.ts";
|
|
13
|
+
import { collectMcpTools, type McpToolDef, mcpToolCallToArgv } from "../mcp/tools.ts";
|
|
14
|
+
import type { Cli, CliInvokeResult } from "../runtime/cli.ts";
|
|
15
15
|
|
|
16
16
|
/** Outcome of resolving a tool name against the program schema. */
|
|
17
17
|
export type ToolLookupResult =
|
|
@@ -179,7 +179,7 @@ export async function executeHttpRouteCall(
|
|
|
179
179
|
/** Maps a headless success result to an HTTP Response. */
|
|
180
180
|
export function headlessSuccessToHttpResponse(
|
|
181
181
|
result: HeadlessToolCallSuccess,
|
|
182
|
-
leafApiResponse?: import("
|
|
182
|
+
leafApiResponse?: import("../core/types.ts").CliHttpResponseConfig,
|
|
183
183
|
defaultStatus?: number,
|
|
184
184
|
): Response {
|
|
185
185
|
return apiSuccessResponse(result.response, leafApiResponse, defaultStatus);
|
package/src/hooks/run.ts
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
Safe async hook runner, failure classification, and invoke error pipeline.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { CliContext } from "
|
|
6
|
-
import { LeafInputError } from "
|
|
5
|
+
import type { CliContext } from "../core/context.ts";
|
|
6
|
+
import { LeafInputError } from "../core/leaf-inputs.ts";
|
|
7
7
|
import type {
|
|
8
8
|
ClientErrorOverride,
|
|
9
9
|
ErrorHookContext,
|
|
10
10
|
InvokeFailureKind,
|
|
11
11
|
InvokeHookContext,
|
|
12
12
|
ServerRuntime,
|
|
13
|
-
} from "
|
|
14
|
-
import { firstErrorLine } from "
|
|
15
|
-
import { type LogEmitter, obscureUnexpectedClientMessage } from "
|
|
13
|
+
} from "../core/types.ts";
|
|
14
|
+
import { firstErrorLine } from "../http/result.ts";
|
|
15
|
+
import { type LogEmitter, obscureUnexpectedClientMessage } from "../log/emitter.ts";
|
|
16
16
|
|
|
17
17
|
/** Runs a hook without letting hook throws escape uncaught. */
|
|
18
18
|
export async function runHook<T>(hook: (() => T | Promise<T>) | undefined, label: string): Promise<T | undefined> {
|
|
@@ -106,7 +106,7 @@ export async function runErrorPipeline(
|
|
|
106
106
|
hookCtx: InvokeHookContext,
|
|
107
107
|
err: unknown,
|
|
108
108
|
failureKind: InvokeFailureKind,
|
|
109
|
-
hooks: import("
|
|
109
|
+
hooks: import("../core/types.ts").CliProgramHooks | undefined,
|
|
110
110
|
emitter: LogEmitter | undefined,
|
|
111
111
|
obscureUnexpected: boolean,
|
|
112
112
|
): Promise<ErrorPipelineResult> {
|
package/src/http/openapi.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Hand-built OpenAPI 3.1 document from exposed HTTP REST routes.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import { collectOptionDefs } from "
|
|
6
|
-
import type { CliHttpMethod, CliNode, CliProgram } from "
|
|
7
|
-
import { CliOptionKind, isCliLeaf, isJsonLeaf } from "
|
|
5
|
+
import { collectOptionDefs } from "../core/parse.ts";
|
|
6
|
+
import type { CliHttpMethod, CliNode, CliProgram } from "../core/types.ts";
|
|
7
|
+
import { CliOptionKind, isCliLeaf, isJsonLeaf } from "../core/types.ts";
|
|
8
8
|
import { collectHttpRoutes, defaultSuccessStatus } from "./routes.ts";
|
|
9
9
|
import { dereferenceJsonSchema } from "./schema-deref.ts";
|
|
10
10
|
|
|
@@ -150,13 +150,15 @@ function jsonResponseEntry(description: string, schema: Record<string, unknown>)
|
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
function livenessGetOp(
|
|
153
|
+
function livenessGetOp(): Record<string, unknown> {
|
|
154
154
|
return {
|
|
155
155
|
tags: [HEALTH_TAG],
|
|
156
|
-
operationId,
|
|
157
|
-
summary,
|
|
156
|
+
operationId: "health_liveness",
|
|
157
|
+
summary: "Liveness probe",
|
|
158
|
+
description:
|
|
159
|
+
"Returns 200 when the HTTP server is online and accepting requests. Does not run config or readiness checks — use for orchestrator liveness probes only.",
|
|
158
160
|
responses: {
|
|
159
|
-
"200": jsonResponseEntry("Server is
|
|
161
|
+
"200": jsonResponseEntry("Server is online", livenessResponseSchema),
|
|
160
162
|
},
|
|
161
163
|
};
|
|
162
164
|
}
|
|
@@ -164,21 +166,19 @@ function livenessGetOp(operationId: string, summary: string): Record<string, unk
|
|
|
164
166
|
/** Framework health probe paths served alongside user command routes. */
|
|
165
167
|
function buildHealthPaths(): Record<string, unknown> {
|
|
166
168
|
return {
|
|
167
|
-
"/health": {
|
|
168
|
-
get: livenessGetOp("health", "Liveness probe (alias of /health/liveness)"),
|
|
169
|
-
},
|
|
170
169
|
"/health/liveness": {
|
|
171
|
-
get: livenessGetOp(
|
|
170
|
+
get: livenessGetOp(),
|
|
172
171
|
},
|
|
173
172
|
"/health/readiness": {
|
|
174
173
|
get: {
|
|
175
174
|
tags: [HEALTH_TAG],
|
|
176
175
|
operationId: "health_readiness",
|
|
177
176
|
summary: "Readiness probe",
|
|
178
|
-
description:
|
|
177
|
+
description:
|
|
178
|
+
"Returns 200 when the server is online and all readiness checks pass (config file, required app config, and optional program.readiness). Returns 503 when any check fails — use for orchestrator readiness probes before routing traffic.",
|
|
179
179
|
responses: {
|
|
180
|
-
"200": jsonResponseEntry("
|
|
181
|
-
"503": jsonResponseEntry("
|
|
180
|
+
"200": jsonResponseEntry("Online and ready to serve traffic", readinessResponseSchema),
|
|
181
|
+
"503": jsonResponseEntry("Online but not ready (one or more checks failed)", readinessResponseSchema),
|
|
182
182
|
},
|
|
183
183
|
},
|
|
184
184
|
},
|
|
@@ -278,7 +278,15 @@ export function generateOpenApi(program: CliProgram): Record<string, unknown> {
|
|
|
278
278
|
description: program.description,
|
|
279
279
|
},
|
|
280
280
|
...(program.httpServer?.enabled
|
|
281
|
-
? {
|
|
281
|
+
? {
|
|
282
|
+
tags: [
|
|
283
|
+
{
|
|
284
|
+
name: HEALTH_TAG,
|
|
285
|
+
description: "Orchestrator health probes — liveness (online) vs readiness (online + checks passed).",
|
|
286
|
+
},
|
|
287
|
+
...commandTags,
|
|
288
|
+
],
|
|
289
|
+
}
|
|
282
290
|
: {}),
|
|
283
291
|
paths,
|
|
284
292
|
};
|
package/src/http/paths.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
HTTP path prefix helpers and framework route guards.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { CliProgram } from "
|
|
5
|
+
import type { CliProgram } from "../core/types.ts";
|
|
6
6
|
|
|
7
7
|
/** Top-level segments reserved for framework routes when `pathPrefix` is empty. */
|
|
8
8
|
export const HTTP_RESERVED_TOP_LEVEL_SEGMENTS = new Set(["health", "openapi.json", "swagger", "tools"]);
|
package/src/http/readiness.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
HTTP/MCP readiness checks for GET /health/readiness (orchestrator probes only).
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { AnyAppConfigSnapshot } from "
|
|
6
|
-
import { missingRequiredConfig } from "
|
|
7
|
-
import type { CliProgram, ReadinessContext, ServerRuntime } from "
|
|
5
|
+
import type { AnyAppConfigSnapshot } from "../config/context.ts";
|
|
6
|
+
import { missingRequiredConfig } from "../config/resolve.ts";
|
|
7
|
+
import type { CliProgram, ReadinessContext, ServerRuntime } from "../core/types.ts";
|
|
8
8
|
|
|
9
9
|
const READINESS_CACHE_MS = 3000;
|
|
10
10
|
|