@ekanos/cli 0.12.0 → 0.13.0

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.
Files changed (47) hide show
  1. package/dist/apps-api.d.ts +3 -2
  2. package/dist/apps-api.js +1 -5
  3. package/dist/apps-api.js.map +1 -1
  4. package/dist/commands/agents-edit.js +1 -1
  5. package/dist/commands/agents-edit.js.map +1 -1
  6. package/dist/commands/apps.d.ts +13 -4
  7. package/dist/commands/apps.js +117 -39
  8. package/dist/commands/apps.js.map +1 -1
  9. package/dist/commands/knowledge.d.ts +37 -0
  10. package/dist/commands/knowledge.js +364 -0
  11. package/dist/commands/knowledge.js.map +1 -0
  12. package/dist/commands/sources.d.ts +4 -0
  13. package/dist/commands/sources.js +115 -1
  14. package/dist/commands/sources.js.map +1 -1
  15. package/dist/commands/team-agents-triggers.js +2 -1
  16. package/dist/commands/team-agents-triggers.js.map +1 -1
  17. package/dist/commands/teams-connect.d.ts +25 -0
  18. package/dist/commands/teams-connect.js +242 -0
  19. package/dist/commands/teams-connect.js.map +1 -0
  20. package/dist/commands/teams-onboard.d.ts +5 -2
  21. package/dist/commands/teams-onboard.js +12 -40
  22. package/dist/commands/teams-onboard.js.map +1 -1
  23. package/dist/commands/teams.d.ts +60 -5
  24. package/dist/commands/teams.js +141 -46
  25. package/dist/commands/teams.js.map +1 -1
  26. package/dist/index.js +62 -6
  27. package/dist/index.js.map +1 -1
  28. package/dist/knowledge-api.d.ts +129 -0
  29. package/dist/knowledge-api.js +138 -0
  30. package/dist/knowledge-api.js.map +1 -0
  31. package/dist/source-products-api.d.ts +59 -0
  32. package/dist/source-products-api.js +113 -0
  33. package/dist/source-products-api.js.map +1 -0
  34. package/dist/team-connect-api.d.ts +244 -0
  35. package/dist/team-connect-api.js +95 -0
  36. package/dist/team-connect-api.js.map +1 -0
  37. package/dist/teams-api.d.ts +1 -0
  38. package/dist/teams-api.js +1 -1
  39. package/dist/teams-api.js.map +1 -1
  40. package/package.json +2 -2
  41. package/templates/package.json.tmpl +4 -4
  42. package/templates/skills/build-agent/SKILL.md +14 -1
  43. package/templates/skills/build-agent/references/agent-json.md +22 -6
  44. package/templates/skills/build-agent/references/app-setup.md +2 -1
  45. package/templates/skills/build-agent/references/set-up-an-integration.md +19 -8
  46. package/templates/skills/build-agent/references/triggers.md +44 -15
  47. package/templates/skills/ekanos-platform/SKILL.md +32 -6
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC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Q;QACd,QAAQ,EAAE,QAAQ;QAClB,KAAK,EAAE,KAAK;QACZ,SAAS,EAAE,UAAU;KACtB,CAAC,CAAC;IACH,OAAO,GAAG,CAAC,OAAO,CAChB,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,EACxD,GAAG,KAAK,GAAG,WAAW,EAAE,CACzB,CAAC;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,GAAe,EAAE,OAAe;;IACvD,MAAM,KAAK,SAAG,aAAa,CAAC,OAAO,CAAC,mCAAI,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAC5D,MAAM,IAAI,GAAG,iBAAiB,OAAO,KAAK,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;IAC/D,GAAG,CAAC,kBAAkB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IAC3D,OAAO,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import * as fs from 'node:fs';\n\nimport { runAgents } from './commands/agents';\nimport { runApps } from './commands/apps';\nimport { runCatalog } from './commands/catalog';\nimport { runDev } from './commands/dev';\nimport { runInit } from './commands/init';\nimport { runLogin } from './commands/login';\nimport { runLogout } from './commands/logout';\nimport { runPublish } from './commands/publish';\nimport { runReviewers } from './commands/reviewers';\nimport { runRoutes } from './commands/routes';\nimport { runApprovals, runRuns } from './commands/runs';\nimport { runSkills } from './commands/skills';\nimport { runSources } from './commands/sources';\nimport { runStatus } from './commands/status';\nimport { runTeams } from './commands/teams';\nimport { runTest } from './commands/test';\nimport { runUpgrade } from './commands/upgrade';\nimport { runUse } from './commands/use';\nimport { runValidate } from './commands/validate';\nimport { runWhoami } from './commands/whoami';\nimport { CliContext, type WriteStream } from './context';\nimport { SDK_DOCS_URL, docsPage } from './docs-links';\nimport { toCliError, usageError } from './errors';\nimport { EXIT_CODES } from './exit-codes';\nimport { type FlagSpecs, parseArgv } from './parse-argv';\n\nexport { CliContext } from './context';\nexport { EXIT_CODES, ERROR_CODES } from './exit-codes';\nexport type { ExitCode, ErrorCode } from './exit-codes';\n\nconst GLOBAL_SPECS: FlagSpecs = {\n json: { type: 'boolean' },\n help: { type: 'boolean' },\n version: { type: 'boolean' },\n};\n\nconst COMMAND_SPECS: Record<string, FlagSpecs> = {\n init: {\n slug: { type: 'string' },\n dir: { type: 'string' },\n force: { type: 'boolean' },\n yes: { type: 'boolean' },\n // Repeatable: each occurrence appends one docs entry (URL or relative\n // path) to the scaffolded ekanos.json.\n docs: { type: 'string', repeatable: true },\n },\n validate: {\n dir: { type: 'string' },\n },\n dev: {\n dir: { type: 'string' },\n port: { type: 'string' },\n host: { type: 'string' },\n force: { type: 'boolean' },\n start: { type: 'boolean' },\n },\n test: {\n dir: { type: 'string' },\n // Skips the vitest JSON-reporter injection and the curated failures\n // appendix, reproducing the pre-appendix raw-passthrough behavior —\n // also the escape hatch if the vitest-detection heuristic ever guesses\n // wrong for a project. See `test-report.ts`.\n raw: { type: 'boolean' },\n },\n login: {\n host: { type: 'string' },\n force: { type: 'boolean' },\n claude: { type: 'boolean' },\n },\n logout: {\n host: { type: 'string' },\n all: { type: 'boolean' },\n },\n whoami: {\n host: { type: 'string' },\n },\n status: {\n host: { type: 'string' },\n dir: { type: 'string' },\n findings: { type: 'boolean' },\n all: { type: 'boolean' },\n watch: { type: 'boolean' },\n },\n sources: {\n host: { type: 'string' },\n dir: { type: 'string' },\n },\n catalog: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n },\n apps: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n 'no-wait': { type: 'boolean' },\n },\n teams: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n connection: { type: 'string' },\n slug: { type: 'string' },\n owner: { type: 'string' },\n role: { type: 'string' },\n yes: { type: 'boolean' },\n // `teams agents|triggers|links|mcp` (team-agents.ts).\n as: { type: 'string' },\n reads: { type: 'string' },\n writes: { type: 'string' },\n effect: { type: 'string' },\n kind: { type: 'string' },\n mode: { type: 'string' },\n url: { type: 'string' },\n auth: { type: 'string' },\n name: { type: 'string' },\n cron: { type: 'string' },\n timezone: { type: 'string' },\n prompt: { type: 'string' },\n filter: { type: 'string' },\n },\n reviewers: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n reach: { type: 'string' },\n team: { type: 'string' },\n },\n routes: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n label: { type: 'string' },\n webhook: { type: 'string' },\n },\n agents: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n // Not `--version`: that is global, and prints the CLI's own version.\n to: { type: 'string' },\n 'base-version': { type: 'string' },\n overwrite: { type: 'boolean' },\n out: { type: 'string' },\n yes: { type: 'boolean' },\n force: { type: 'boolean' },\n claude: { type: 'boolean' },\n // `agents test <key> --team <slug> --prompt|--input [--follow]`.\n team: { type: 'string' },\n prompt: { type: 'string' },\n input: { type: 'string' },\n follow: { type: 'boolean' },\n // `apply`: `--no-skills` skips pushing the skill folders beside the agent.\n skills: { type: 'boolean' },\n // policy | triggers | links | overrides\n event: { type: 'string' },\n filter: { type: 'string', repeatable: true },\n disabled: { type: 'boolean' },\n cron: { type: 'string' },\n timezone: { type: 'string' },\n kind: { type: 'string' },\n mode: { type: 'string' },\n reads: { type: 'string' },\n writes: { type: 'string' },\n publish: { type: 'boolean' },\n },\n skills: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n team: { type: 'string' },\n out: { type: 'string' },\n },\n runs: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n team: { type: 'string' },\n agent: { type: 'string' },\n prompt: { type: 'string' },\n input: { type: 'string' },\n follow: { type: 'boolean' },\n },\n approvals: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n team: { type: 'string' },\n reason: { type: 'string' },\n body: { type: 'string' },\n },\n use: {\n host: { type: 'string' },\n dir: { type: 'string' },\n },\n publish: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n yes: { type: 'boolean' },\n },\n upgrade: {\n dir: { type: 'string' },\n host: { type: 'string' },\n check: { type: 'boolean' },\n yes: { type: 'boolean' },\n // `--no-verify` is the negation of this — parse-argv's `--no-<bool>`\n // convention (same as `--no-json`/`--no-start`), not a flag of its own.\n verify: { type: 'boolean' },\n },\n};\n\n/** Commands that take positional arguments, and what each means, in order. Every other command is positional-free. */\nconst POSITIONAL_COMMANDS: Record<string, readonly string[]> = {\n use: ['source-slug'],\n catalog: ['product-slug'],\n apps: ['subcommand', 'product-slug'],\n // `teams agents policy <team> <key> set <tool> auto` is the longest form.\n teams: [\n 'subcommand',\n 'team-slug',\n 'product-slug',\n 'webhook-id',\n 'role',\n 'arg-6',\n 'arg-7',\n ],\n reviewers: ['subcommand', 'email'],\n routes: ['subcommand', 'product-or-event-id', 'value', 'team-slug'],\n skills: ['subcommand', 'slug-or-path'],\n runs: ['subcommand', 'agent-key-or-run-id'],\n approvals: ['subcommand', 'approval-id'],\n // `triggers <key> add event <trigger-key>` is the longest form: five tokens.\n agents: ['subcommand', 'key-or-path', 'action', 'arg', 'value'],\n};\n\nconst COMMANDS = Object.keys(COMMAND_SPECS);\n\nconst USAGE = [\n 'Usage: ekanos <command> [options]',\n '',\n 'Commands:',\n ' init Scaffold a new integration project into ./<slug> (--slug <slug> --yes)',\n ' validate Validate ekanos.json + the integration definition (--json)',\n ' dev Scaffold .ekanos/harness and run it with your own Next',\n ' test Run the project test script via its package manager (--json).',\n ' For a vitest test script, also renders a curated failures',\n ' appendix from a JSON reporter report; --raw skips that and',\n ' the reporter injection entirely.',\n ' login Authenticate against an Ekanos host in a browser (--host <url>;',\n ' offers to add the Ekanos docs to Claude Code: --claude|--no-claude)',\n ' logout Revoke and delete the stored session (--host <url> | --all)',\n ' whoami Print the identity the stored session authenticates as, plus',\n ' a compact list of the sources you hold a seat on',\n \" status Show login state and this project's submissions on the host\",\n ' (--findings for full gate findings, --all to expand other',\n ' integrations in the source, --watch to block until this',\n \" project's current version reaches a gate verdict)\",\n ' sources List every source you hold a developer/source-admin seat on',\n ' catalog What a source can already use, and how to set it up',\n ' (\"ekanos catalog [<product-slug>] --source <slug>\", --json)',\n \" apps The Source's app for an integration teams sign in through:\",\n ' show <product> | set <product> (Source admin; takes the secret',\n ' at your terminal) | connect <product> [--no-wait] (one',\n \" connection for the whole Source, used by the Source's provided\",\n ' agents in every team) | disconnect <product> | list',\n \" teams A Source's teams, for the Source admin:\",\n ' create <name> [--slug <slug>] [--owner <email>] (you own it',\n ' unless --owner, who is invited as owner) |',\n ' members list <team> | members invite <team> <email> [--role',\n ' <role>] (default member; sends the invitation email) |',\n ' members role <team> <email> <role> | members remove <team>',\n \" <email> --yes | roles list <team> (each role's permissions) |\",\n ' connect <team> <product> (the link a member opens to sign in',\n ' an integration, and whether it is connected) |',\n ' list | show <team> <product> (a checklist: fields, callback',\n ' URLs, webhooks, connect link) | app set <team> <product>',\n ' [--connection <id>] (takes the secrets at your terminal) |',\n ' webhook <team> <product> [<webhook-id>] [--yes] (URL shown once)',\n \" A team's agents, for the Source admin (teams <area> <verb> <team> …):\",\n ' agents list <team> | agents enable <team> <key> [--as <member-email>]',\n ' | agents disable|unpin <team> <key> | agents pin <team> <key> <version>',\n ' | agents policy <team> <key> [set <tool> auto|approve | unset <tool>]',\n ' [--reads auto|approve] [--writes auto|approve]',\n ' triggers list|add|remove <team> <key> … | links list|add|remove',\n ' <team> <from-key> [<to-key> --kind talk|delegate --mode await|handoff]',\n ' | mcp list|add|status|token|effect <team> [<server-key> …]',\n ' (see \"ekanos teams --help\")',\n ' reviewers Who decides agent reply drafts, for the Source admin:',\n ' list | add <email> --reach source|team [--team <slug>] |',\n ' remove <email> [--team <slug>]',\n \" routes Route a Source connection's events to teams, for the Source admin:\",\n ' list [<product>] | options <product> | set <product> <value> <team>',\n ' [--label <name>] | remove <product> <value> | webhook <product>',\n ' [--webhook <id>] (URL shown once) | unrouted [<product>] |',\n ' replay <event-id>',\n \" agents The source's agent templates, held by Ekanos:\",\n ' init [<dir>] [--claude|--no-claude] (skills + docs MCP for designing',\n ' agents with Claude; offers to add the docs to Claude Code)',\n ' list | show <key> | pull <key> [--out <dir>]',\n ' apply <dir|file> [--base-version <n>] [--overwrite]',\n ' publish <key> [--to <n>] --yes | rollback <key> --to <n> --yes',\n ' test <key> --team <slug> (--prompt \"…\" | --input <file.json>)',\n ' [--follow] (runs the latest, unpublished version on one team;',\n ' same grant, policy, approvals and audit; marked as a test)',\n ' apply also pushes <dir>/skills/<slug>/ folders first and names',\n ' them in the agent (--no-skills skips that)',\n ' Edit one template in place (stores a draft version; --publish',\n ' also rolls it out, with --yes):',\n ' policy <key> [set <tool> auto|approve | unset <tool>]',\n ' [--reads auto|approve] [--writes auto|approve]',\n ' triggers <key> [list | add event <k> --event <slug.event>',\n ' [--filter field=a,b]... | add schedule <k> --cron \"<expr>\"',\n ' [--timezone <tz>] --prompt <text> | add webhook <k> --prompt',\n ' <text> | remove <k>] [--prompt <text>] [--disabled]',\n ' links <key> [list | add <to-key> --kind talk|delegate',\n ' [--mode await|handoff] | remove <to-key> [--kind <kind>]]',\n ' overrides <key> [enable|disable policy|triggers|links]',\n ' (off: teams follow the template exactly; on: teams keep',\n ' their own differences)',\n \" skills The source's skills (SKILL.md folders), held by Ekanos:\",\n ' list [--team <t>] | show <slug> [--team <t>] |',\n ' push <dir> [--team <t>] (a new version, live at once; created',\n ' on first push, \"unchanged\" when identical; --team: that team\\'s',\n ' own skill, no other team sees it) | pull <slug> [--out <dir>]',\n \" runs Run and inspect a team's agents, as the Source admin:\",\n ' start <agent-key> --team <slug> (--prompt \"…\" | --input',\n ' <file.json>) [--follow] | list --team <slug> [--agent <key>] |',\n ' show <run-id> --team <slug> (--json: transcript, tool calls,',\n ' how each was authorized, approvals)',\n \" approvals What a team's agent runs wait on: list --team <slug> |\",\n ' approve|reject <id> --team <slug> [--reason \"…\"] |',\n ' edit <id> --team <slug> --body <file> (edit & send a reply draft)',\n ' use Set this project\\'s publish target (\"ekanos use <source-slug>\")',\n ' publish Validate, pack and submit the integration to an Ekanos host',\n ' upgrade Move this toolchain to a coherent target version, with',\n ' verify-and-rollback (--check --yes --no-verify --host <url>)',\n '',\n 'Keeping the toolchain current:',\n ' validate, dev and publish all check for a newer @ekanos/cli in the',\n ' background (never blocking, silenced by EKANOS_NO_UPDATE_CHECK) and warn',\n ' on stderr when one exists. Run \"ekanos upgrade --check\" any time a',\n ' validate finding smells like version skew (an unrecognized-key error you',\n ' are confident is correct) — it is read-only and safe to run freely. A',\n ' bare \"ekanos upgrade\" MUTATES the project (installs the target versions,',\n ' verifies with validate + the test script, rolls back on any failure).',\n '',\n 'Host resolution (logout, whoami, status, sources, catalog, apps, teams, reviewers, routes, agents, skills, runs, approvals, use, publish, upgrade):',\n ' --host, else EKANOS_HOST, else the \"host\" field in ekanos.json, else the',\n ' sole stored login. \"ekanos publish\" saves host and source to ekanos.json.',\n ' \"ekanos login\" never reads ekanos.json for a host (--host, else',\n ' EKANOS_HOST, else the sole stored login) — it is the verb that creates',\n ' credentials, so a committed file must never choose where they go.',\n '',\n 'Publish targeting (see \"ekanos sources\" / \"ekanos use\"):',\n ' publish refuses (FORBIDDEN) a source you hold no seat on. With multiple',\n ' seats and an implicit (ekanos.json) source, a human run asks to confirm',\n ' the target; a scripted/JSON run needs --source or --yes to proceed —',\n ' it never prompts and never guesses.',\n '',\n 'Global options:',\n ' --json Emit a single JSON envelope on stdout (auto-on when piped);',\n ' --no-json forces the human-readable form',\n ' --version Print the CLI version',\n ' --help Show this help',\n].join('\\n');\n\nexport interface RunOptions {\n stdout?: WriteStream;\n stderr?: WriteStream;\n env?: Record<string, string | undefined>;\n cwd?: string;\n /**\n * Test-only override for `publish`'s interactive-confirm gate and `init`\n * / `login`'s clack wizard gate (`canWizard` in `wizard.ts`) — see\n * `PublishArgs` in `commands/publish.ts`. Never set this from real CLI\n * wiring; it exists so a test can exercise the human y/N confirm branch or\n * the wizard flow without a real terminal.\n */\n stdinIsTTY?: boolean;\n confirm?: (question: string) => Promise<boolean>;\n /** Test-only answers for `apps set` / `teams app set` questions — never set from real CLI wiring. */\n ask?: (question: string) => Promise<string>;\n askSecret?: (question: string) => Promise<string>;\n /**\n * Test-only override for `status --watch`'s poll delay — see `StatusArgs`\n * in `commands/status.ts`. Never set this from real CLI wiring; it exists\n * so a test can exercise the poll loop without waiting 30s per iteration.\n */\n sleep?: (ms: number) => Promise<void>;\n /**\n * Test-only override for `status`'s AGE column (\"now\") — see `StatusArgs`\n * in `commands/status.ts`. Never set this from real CLI wiring; it exists\n * so a test can assert an exact `relativeTime` string deterministically.\n */\n now?: Date;\n}\n\n/**\n * The single entry point. Resolves the agent-native envelope once, dispatches\n * to a verb, and guarantees exactly one terminal emission (success or error).\n * Returns the process exit code — `bin.ts` is the only place that calls\n * `process.exit`, so this stays fully testable.\n */\nexport async function run(\n argv: readonly string[],\n options: RunOptions = {},\n): Promise<number> {\n const jsonFlag = scanJsonFlag(argv);\n const ctx = new CliContext({\n jsonFlag,\n stdout: options.stdout,\n stderr: options.stderr,\n env: options.env,\n });\n const cwd = options.cwd ?? process.cwd();\n const env = options.env ?? process.env;\n\n try {\n // `--version` is global and verb-independent, so it is answered before the\n // command is even resolved: `ekanos --version` and `ekanos validate\n // --version` both report the tool's version and exit 0.\n if (scanFlagPresence(argv, 'version')) {\n return emitVersion(ctx);\n }\n\n const { command, rest } = splitCommand(argv);\n\n // Top-level help / no command.\n if (!command) {\n if (scanFlagPresence(rest, 'help') || argv.length === 0) {\n return emitHelp(ctx);\n }\n // A leading token that is not a command (e.g. `--nonsense`).\n ctx.emitClaudeCodeHint({\n tool: 'ekanos',\n error: 'unknown-command',\n commands: COMMANDS,\n usage: USAGE,\n });\n throw usageError(\n `Unknown command or flag \"${argv[0]}\".`,\n `Run one of: ${COMMANDS.join(', ')}. See \"ekanos --help\".`,\n );\n }\n\n if (!COMMANDS.includes(command)) {\n ctx.emitClaudeCodeHint({\n tool: 'ekanos',\n error: 'unknown-command',\n given: command,\n commands: COMMANDS,\n usage: USAGE,\n });\n throw usageError(\n `Unknown command \"${command}\".`,\n `Run one of: ${COMMANDS.join(', ')}. See \"ekanos --help\".`,\n );\n }\n\n const specs: FlagSpecs = { ...GLOBAL_SPECS, ...COMMAND_SPECS[command] };\n const parsed = parseArgv(rest, specs);\n\n if (parsed.flags.help === true) {\n return emitCommandHelp(ctx, command);\n }\n\n const positionalNames = POSITIONAL_COMMANDS[command] ?? [];\n\n if (positionalNames.length === 0 && parsed.positionals.length > 0) {\n throw usageError(\n `\"${command}\" takes no positional arguments (got \"${parsed.positionals[0]}\").`,\n `Pass options as flags, e.g. \"--dir <path>\". See \"ekanos ${command} --help\".`,\n );\n }\n\n if (parsed.positionals.length > positionalNames.length) {\n const usage = positionalNames.map((name) => `<${name}>`).join(' ');\n throw usageError(\n `\"${command}\" takes at most ${positionalNames.length} positional ` +\n `argument${positionalNames.length === 1 ? '' : 's'} (${usage}), ` +\n `got ${parsed.positionals.length}.`,\n `e.g. \"ekanos ${command} ${usage}\". See \"ekanos ${command} --help\".`,\n );\n }\n\n const dir = (parsed.flags.dir as string | undefined) ?? cwd;\n\n switch (command) {\n case 'init':\n return await runInit(ctx, {\n slug: parsed.flags.slug as string | undefined,\n dir: parsed.flags.dir as string | undefined,\n cwd,\n force: parsed.flags.force === true,\n yes: parsed.flags.yes === true,\n docs: parsed.flags.docs as string[] | undefined,\n stdinIsTTY: options.stdinIsTTY,\n });\n case 'validate':\n return await runValidate(ctx, { dir, env });\n case 'dev':\n return await runDev(ctx, {\n dir,\n port: parsed.flags.port as string | undefined,\n host: parsed.flags.host as string | undefined,\n force: parsed.flags.force === true,\n start: parsed.flags.start as boolean | undefined,\n env,\n });\n case 'test':\n return await runTest(ctx, {\n dir,\n passthrough: parsed.passthrough,\n raw: parsed.flags.raw === true,\n });\n case 'login':\n return await runLogin(ctx, {\n host: parsed.flags.host as string | undefined,\n force: parsed.flags.force === true,\n claude: parsed.flags.claude as boolean | undefined,\n cwd,\n env,\n stdinIsTTY: options.stdinIsTTY,\n });\n case 'logout':\n return await runLogout(ctx, {\n host: parsed.flags.host as string | undefined,\n all: parsed.flags.all === true,\n cwd,\n env,\n });\n case 'whoami':\n return await runWhoami(ctx, {\n host: parsed.flags.host as string | undefined,\n cwd,\n env,\n });\n case 'status':\n return await runStatus(ctx, {\n host: parsed.flags.host as string | undefined,\n dir,\n env,\n findings: parsed.flags.findings === true,\n all: parsed.flags.all === true,\n watch: parsed.flags.watch === true,\n sleep: options.sleep,\n now: options.now,\n });\n case 'sources':\n return await runSources(ctx, {\n host: parsed.flags.host as string | undefined,\n dir,\n env,\n });\n case 'catalog':\n return await runCatalog(ctx, {\n host: parsed.flags.host as string | undefined,\n source: parsed.flags.source as string | undefined,\n product: parsed.positionals[0],\n dir,\n env,\n });\n case 'apps':\n return await runApps(ctx, {\n host: parsed.flags.host as string | undefined,\n source: parsed.flags.source as string | undefined,\n subcommand: parsed.positionals[0],\n product: parsed.positionals[1],\n dir,\n env,\n stdinIsTTY: options.stdinIsTTY,\n ask: options.ask,\n askSecret: options.askSecret,\n confirm: options.confirm,\n noWait: parsed.flags['no-wait'] === true,\n });\n case 'teams':\n return await runTeams(ctx, {\n host: parsed.flags.host as string | undefined,\n source: parsed.flags.source as string | undefined,\n positionals: parsed.positionals,\n connection: parsed.flags.connection as string | undefined,\n slug: parsed.flags.slug as string | undefined,\n owner: parsed.flags.owner as string | undefined,\n role: parsed.flags.role as string | undefined,\n yes: parsed.flags.yes === true,\n flags: parsed.flags,\n dir,\n env,\n stdinIsTTY: options.stdinIsTTY,\n ask: options.ask,\n askSecret: options.askSecret,\n });\n case 'reviewers':\n return await runReviewers(ctx, {\n host: parsed.flags.host as string | undefined,\n source: parsed.flags.source as string | undefined,\n positionals: parsed.positionals,\n reach: parsed.flags.reach as string | undefined,\n team: parsed.flags.team as string | undefined,\n dir,\n env,\n });\n case 'routes':\n return await runRoutes(ctx, {\n host: parsed.flags.host as string | undefined,\n source: parsed.flags.source as string | undefined,\n positionals: parsed.positionals,\n label: parsed.flags.label as string | undefined,\n webhook: parsed.flags.webhook as string | undefined,\n dir,\n env,\n });\n case 'agents':\n return await runAgents(ctx, {\n host: parsed.flags.host as string | undefined,\n source: parsed.flags.source as string | undefined,\n subcommand: parsed.positionals[0],\n target: parsed.positionals[1],\n to: parsed.flags.to as string | undefined,\n baseVersion: parsed.flags['base-version'] as string | undefined,\n overwrite: parsed.flags.overwrite === true,\n out: parsed.flags.out as string | undefined,\n yes: parsed.flags.yes === true,\n force: parsed.flags.force === true,\n claude: parsed.flags.claude as boolean | undefined,\n skills: parsed.flags.skills as boolean | undefined,\n rest: parsed.positionals.slice(2),\n event: parsed.flags.event as string | undefined,\n filter: parsed.flags.filter as string[] | undefined,\n disabled: parsed.flags.disabled === true,\n cron: parsed.flags.cron as string | undefined,\n timezone: parsed.flags.timezone as string | undefined,\n kind: parsed.flags.kind as string | undefined,\n mode: parsed.flags.mode as string | undefined,\n reads: parsed.flags.reads as string | undefined,\n writes: parsed.flags.writes as string | undefined,\n publish: parsed.flags.publish === true,\n dir,\n env,\n stdinIsTTY: options.stdinIsTTY,\n confirm: options.confirm,\n team: parsed.flags.team as string | undefined,\n prompt: parsed.flags.prompt as string | undefined,\n input: parsed.flags.input as string | undefined,\n follow: parsed.flags.follow === true,\n });\n case 'runs':\n case 'approvals':\n return await (command === 'runs' ? runRuns : runApprovals)(ctx, {\n host: parsed.flags.host as string | undefined,\n source: parsed.flags.source as string | undefined,\n positionals: parsed.positionals,\n team: parsed.flags.team as string | undefined,\n agent: parsed.flags.agent as string | undefined,\n prompt: parsed.flags.prompt as string | undefined,\n input: parsed.flags.input as string | undefined,\n follow: parsed.flags.follow === true,\n reason: parsed.flags.reason as string | undefined,\n body: parsed.flags.body as string | undefined,\n dir,\n env,\n sleep: options.sleep,\n });\n case 'skills':\n return await runSkills(ctx, {\n host: parsed.flags.host as string | undefined,\n source: parsed.flags.source as string | undefined,\n subcommand: parsed.positionals[0],\n target: parsed.positionals[1],\n team: parsed.flags.team as string | undefined,\n out: parsed.flags.out as string | undefined,\n dir,\n env,\n });\n case 'use':\n return await runUse(ctx, {\n host: parsed.flags.host as string | undefined,\n dir,\n slug: parsed.positionals[0],\n env,\n });\n case 'publish':\n return await runPublish(ctx, {\n host: parsed.flags.host as string | undefined,\n source: parsed.flags.source as string | undefined,\n dir,\n yes: parsed.flags.yes === true,\n env,\n stdinIsTTY: options.stdinIsTTY,\n confirm: options.confirm,\n });\n case 'upgrade':\n return await runUpgrade(ctx, {\n dir,\n host: parsed.flags.host as string | undefined,\n env,\n check: parsed.flags.check === true,\n yes: parsed.flags.yes === true,\n noVerify: parsed.flags.verify === false,\n stdinIsTTY: options.stdinIsTTY,\n confirm: options.confirm,\n });\n default:\n // Unreachable — COMMANDS gate above — but keeps the switch total.\n throw usageError(\n `Unknown command \"${command}\".`,\n `Run one of: ${COMMANDS.join(', ')}.`,\n );\n }\n } catch (error) {\n return ctx.fail(toCliError(error));\n }\n}\n\n/**\n * Presence of `--json` (or `--no-json`) BEFORE the first `--` passthrough.\n *\n * Tri-state on purpose. `undefined` means \"the user expressed no preference\",\n * which is what lets the context fall back to inferring the mode from a\n * non-TTY stdout or CLAUDECODE. Collapsing `--no-json` to `false` here would\n * make it indistinguishable from absence, and the flag could then never turn\n * JSON mode OFF in exactly the cases it exists for.\n */\nfunction scanJsonFlag(argv: readonly string[]): boolean | undefined {\n for (const token of argv) {\n if (token === '--') break;\n if (token === '--json') return true;\n if (token === '--no-json') return false;\n }\n return undefined;\n}\n\nfunction scanFlagPresence(argv: readonly string[], name: string): boolean {\n for (const token of argv) {\n if (token === '--') break;\n if (token === `--${name}`) return true;\n }\n return false;\n}\n\n/**\n * Split argv into the command (first bare token before `--`) and the rest\n * (everything else, order preserved, including global flags and the `--`\n * passthrough). Global flags are all booleans, so any bare token is the\n * command — no value-consumption ambiguity.\n */\nfunction splitCommand(argv: readonly string[]): {\n command: string | null;\n rest: string[];\n} {\n for (let i = 0; i < argv.length; i++) {\n const token = argv[i]!;\n if (token === '--') break;\n if (!token.startsWith('-')) {\n return {\n command: token,\n rest: [...argv.slice(0, i), ...argv.slice(i + 1)],\n };\n }\n }\n return { command: null, rest: [...argv] };\n}\n\n/**\n * The CLI's own version, read from the package manifest at runtime rather than\n * baked in by the build — one source of truth, so a release bump cannot leave\n * `--version` reporting a stale number. The path resolves identically from\n * `src/index.ts` and from the emitted `dist/index.js`, both of which sit one\n * directory below the package root.\n */\nfunction readVersion(): string {\n const manifest = new URL('../package.json', import.meta.url);\n const parsed: unknown = JSON.parse(fs.readFileSync(manifest, 'utf8'));\n\n return typeof parsed === 'object' &&\n parsed !== null &&\n 'version' in parsed &&\n typeof parsed.version === 'string'\n ? parsed.version\n : '0.0.0';\n}\n\nfunction emitVersion(ctx: CliContext): number {\n const version = readVersion();\n\n return ctx.succeed({ name: 'ekanos', version }, version);\n}\n\nconst DOCS_FOOTER = `\\nDocs: ${SDK_DOCS_URL} (commands: ${docsPage('cli/commands')})`;\n\nfunction emitHelp(ctx: CliContext): number {\n ctx.emitClaudeCodeHint({\n tool: 'ekanos',\n commands: COMMANDS,\n usage: USAGE,\n exitCodes: EXIT_CODES,\n });\n return ctx.succeed(\n { usage: USAGE, commands: COMMANDS, docs: SDK_DOCS_URL },\n `${USAGE}${DOCS_FOOTER}`,\n );\n}\n\nfunction emitCommandHelp(ctx: CliContext, command: string): number {\n const specs = COMMAND_SPECS[command] ?? {};\n const flags = Object.keys(specs).map((name) => `--${name}`);\n const help = `Usage: ekanos ${command} [${flags.join('] [')}]`;\n ctx.emitClaudeCodeHint({ tool: 'ekanos', command, flags });\n return ctx.succeed({ command, flags }, help);\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACl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AE,KAAK,EAAE,CAAC,CAAC;IAC3D,OAAO,GAAG,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["import * as fs from 'node:fs';\n\nimport { runAgents } from './commands/agents';\nimport { runApps } from './commands/apps';\nimport { runCatalog } from './commands/catalog';\nimport { runDev } from './commands/dev';\nimport { runInit } from './commands/init';\nimport { runKnowledge } from './commands/knowledge';\nimport { runLogin } from './commands/login';\nimport { runLogout } from './commands/logout';\nimport { runPublish } from './commands/publish';\nimport { runReviewers } from './commands/reviewers';\nimport { runRoutes } from './commands/routes';\nimport { runApprovals, runRuns } from './commands/runs';\nimport { runSkills } from './commands/skills';\nimport { runSources } from './commands/sources';\nimport { runStatus } from './commands/status';\nimport { runTeams } from './commands/teams';\nimport { runTest } from './commands/test';\nimport { runUpgrade } from './commands/upgrade';\nimport { runUse } from './commands/use';\nimport { runValidate } from './commands/validate';\nimport { runWhoami } from './commands/whoami';\nimport { CliContext, type WriteStream } from './context';\nimport { SDK_DOCS_URL, docsPage } from './docs-links';\nimport { toCliError, usageError } from './errors';\nimport { EXIT_CODES } from './exit-codes';\nimport { type FlagSpecs, parseArgv } from './parse-argv';\n\nexport { CliContext } from './context';\nexport { EXIT_CODES, ERROR_CODES } from './exit-codes';\nexport type { ExitCode, ErrorCode } from './exit-codes';\n\nconst GLOBAL_SPECS: FlagSpecs = {\n json: { type: 'boolean' },\n help: { type: 'boolean' },\n version: { type: 'boolean' },\n};\n\nconst COMMAND_SPECS: Record<string, FlagSpecs> = {\n init: {\n slug: { type: 'string' },\n dir: { type: 'string' },\n force: { type: 'boolean' },\n yes: { type: 'boolean' },\n // Repeatable: each occurrence appends one docs entry (URL or relative\n // path) to the scaffolded ekanos.json.\n docs: { type: 'string', repeatable: true },\n },\n validate: {\n dir: { type: 'string' },\n },\n dev: {\n dir: { type: 'string' },\n port: { type: 'string' },\n host: { type: 'string' },\n force: { type: 'boolean' },\n start: { type: 'boolean' },\n },\n test: {\n dir: { type: 'string' },\n // Skips the vitest JSON-reporter injection and the curated failures\n // appendix, reproducing the pre-appendix raw-passthrough behavior —\n // also the escape hatch if the vitest-detection heuristic ever guesses\n // wrong for a project. See `test-report.ts`.\n raw: { type: 'boolean' },\n },\n login: {\n host: { type: 'string' },\n force: { type: 'boolean' },\n claude: { type: 'boolean' },\n },\n logout: {\n host: { type: 'string' },\n all: { type: 'boolean' },\n },\n whoami: {\n host: { type: 'string' },\n },\n status: {\n host: { type: 'string' },\n dir: { type: 'string' },\n findings: { type: 'boolean' },\n all: { type: 'boolean' },\n watch: { type: 'boolean' },\n },\n sources: {\n host: { type: 'string' },\n dir: { type: 'string' },\n // `sources products [enable|disable <product>]`.\n source: { type: 'string' },\n yes: { type: 'boolean' },\n },\n catalog: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n },\n apps: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n 'no-wait': { type: 'boolean' },\n },\n teams: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n connection: { type: 'string' },\n // `teams app set`: which fields to enter, non-secret values, removals.\n field: { type: 'string', repeatable: true },\n set: { type: 'string', repeatable: true },\n clear: { type: 'string', repeatable: true },\n slug: { type: 'string' },\n owner: { type: 'string' },\n role: { type: 'string' },\n yes: { type: 'boolean' },\n // `teams agents|triggers|links|mcp` (team-agents.ts).\n as: { type: 'string' },\n reads: { type: 'string' },\n writes: { type: 'string' },\n effect: { type: 'string' },\n kind: { type: 'string' },\n mode: { type: 'string' },\n url: { type: 'string' },\n auth: { type: 'string' },\n name: { type: 'string' },\n cron: { type: 'string' },\n timezone: { type: 'string' },\n prompt: { type: 'string' },\n filter: { type: 'string' },\n // `teams connect`: `--no-wait`, `--no-open` (the negation of `open`),\n // `--link-only`.\n 'no-wait': { type: 'boolean' },\n open: { type: 'boolean' },\n 'link-only': { type: 'boolean' },\n },\n reviewers: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n reach: { type: 'string' },\n team: { type: 'string' },\n },\n routes: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n label: { type: 'string' },\n webhook: { type: 'string' },\n },\n agents: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n // Not `--version`: that is global, and prints the CLI's own version.\n to: { type: 'string' },\n 'base-version': { type: 'string' },\n overwrite: { type: 'boolean' },\n out: { type: 'string' },\n yes: { type: 'boolean' },\n force: { type: 'boolean' },\n claude: { type: 'boolean' },\n // `agents test <key> --team <slug> --prompt|--input [--follow]`.\n team: { type: 'string' },\n prompt: { type: 'string' },\n input: { type: 'string' },\n follow: { type: 'boolean' },\n // `apply`: `--no-skills` skips pushing the skill folders beside the agent.\n skills: { type: 'boolean' },\n // policy | triggers | links | overrides\n event: { type: 'string' },\n filter: { type: 'string', repeatable: true },\n disabled: { type: 'boolean' },\n cron: { type: 'string' },\n timezone: { type: 'string' },\n kind: { type: 'string' },\n mode: { type: 'string' },\n reads: { type: 'string' },\n writes: { type: 'string' },\n publish: { type: 'boolean' },\n },\n skills: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n team: { type: 'string' },\n out: { type: 'string' },\n },\n knowledge: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n team: { type: 'string' },\n out: { type: 'string' },\n },\n runs: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n team: { type: 'string' },\n agent: { type: 'string' },\n prompt: { type: 'string' },\n input: { type: 'string' },\n follow: { type: 'boolean' },\n },\n approvals: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n team: { type: 'string' },\n reason: { type: 'string' },\n body: { type: 'string' },\n },\n use: {\n host: { type: 'string' },\n dir: { type: 'string' },\n },\n publish: {\n host: { type: 'string' },\n source: { type: 'string' },\n dir: { type: 'string' },\n yes: { type: 'boolean' },\n },\n upgrade: {\n dir: { type: 'string' },\n host: { type: 'string' },\n check: { type: 'boolean' },\n yes: { type: 'boolean' },\n // `--no-verify` is the negation of this — parse-argv's `--no-<bool>`\n // convention (same as `--no-json`/`--no-start`), not a flag of its own.\n verify: { type: 'boolean' },\n },\n};\n\n/** Commands that take positional arguments, and what each means, in order. Every other command is positional-free. */\nconst POSITIONAL_COMMANDS: Record<string, readonly string[]> = {\n use: ['source-slug'],\n sources: ['subcommand', 'verb', 'product-slug'],\n catalog: ['product-slug'],\n apps: ['subcommand', 'product-slug'],\n // `teams agents policy <team> <key> set <tool> auto` is the longest form.\n teams: [\n 'subcommand',\n 'team-slug',\n 'product-slug',\n 'webhook-id',\n 'role',\n 'arg-6',\n 'arg-7',\n ],\n reviewers: ['subcommand', 'email'],\n routes: ['subcommand', 'product-or-event-id', 'value', 'team-slug'],\n skills: ['subcommand', 'slug-or-path'],\n knowledge: ['subcommand', 'path-or-query'],\n runs: ['subcommand', 'agent-key-or-run-id'],\n approvals: ['subcommand', 'approval-id'],\n // `triggers <key> add event <trigger-key>` is the longest form: five tokens.\n agents: ['subcommand', 'key-or-path', 'action', 'arg', 'value'],\n};\n\nconst COMMANDS = Object.keys(COMMAND_SPECS);\n\nconst USAGE = [\n 'Usage: ekanos <command> [options]',\n '',\n 'Commands:',\n ' init Scaffold a new integration project into ./<slug> (--slug <slug> --yes)',\n ' validate Validate ekanos.json + the integration definition (--json)',\n ' dev Scaffold .ekanos/harness and run it with your own Next',\n ' test Run the project test script via its package manager (--json).',\n ' For a vitest test script, also renders a curated failures',\n ' appendix from a JSON reporter report; --raw skips that and',\n ' the reporter injection entirely.',\n ' login Authenticate against an Ekanos host in a browser (--host <url>;',\n ' offers to add the Ekanos docs to Claude Code: --claude|--no-claude)',\n ' logout Revoke and delete the stored session (--host <url> | --all)',\n ' whoami Print the identity the stored session authenticates as, plus',\n ' a compact list of the sources you hold a seat on',\n \" status Show login state and this project's submissions on the host\",\n ' (--findings for full gate findings, --all to expand other',\n ' integrations in the source, --watch to block until this',\n \" project's current version reaches a gate verdict)\",\n ' sources List every source you hold a developer/source-admin seat on |',\n ' products [--source <slug>] (each product, Experience or',\n ' Integration, and whether it is enabled for the Source) |',\n ' products enable <product> | products disable <product> --yes',\n ' (a super-admin grant: an \"ekanos login\" session is refused',\n ' and pointed at /admin)',\n ' catalog What a source can already use, and how to set it up',\n ' (\"ekanos catalog [<product-slug>] --source <slug>\", --json)',\n \" apps The Source's app for an integration teams sign in through:\",\n ' show <product> | set <product> (Source admin; takes the secret',\n ' at your terminal, Enter keeps a saved value) | connect',\n ' <product> [--no-wait] (one',\n \" connection for the whole Source, used by the Source's provided\",\n ' agents in every team) | disconnect <product> | list',\n \" teams A Source's teams, for the Source admin:\",\n ' create <name> [--slug <slug>] [--owner <email>] (you own it',\n ' unless --owner, who is invited as owner) |',\n ' members list <team> | members invite <team> <email> [--role',\n ' <role>] (default member; sends the invitation email) |',\n ' members role <team> <email> <role> | members remove <team>',\n \" <email> --yes | roles list <team> (each role's permissions) |\",\n ' connect <team> <product> [--as <member-email>] [--no-wait]',\n \" [--no-open] [--link-only] (connects it: asks the form's fields\",\n ' at your terminal, or opens the sign-in for you or the member',\n \" --as names and waits; --link-only prints the team's page) |\",\n ' list | show <team> <product> (a checklist: fields, callback',\n ' URLs, webhooks, connect link) | app set <team> <product>',\n ' [--connection <id>] [--field <name>]… [--set <name>=<value>]…',\n ' [--clear <name>]… (any one field at a time; a field you skip',\n ' keeps its saved value; secrets only at your terminal) |',\n ' webhook <team> <product> [<webhook-id>] [--yes] (URL shown once)',\n \" A team's agents, for the Source admin (teams <area> <verb> <team> …):\",\n ' agents list <team> | agents enable <team> <key> [--as <member-email>]',\n ' | agents disable|unpin <team> <key> | agents pin <team> <key> <version>',\n ' | agents policy <team> <key> [set <tool> auto|approve | unset <tool>]',\n ' [--reads auto|approve] [--writes auto|approve]',\n ' triggers list|add|remove <team> <key> … | links list|add|remove',\n ' <team> <from-key> [<to-key> --kind talk|delegate --mode await|handoff]',\n ' | mcp list|add|status|token|effect <team> [<server-key> …]',\n ' (see \"ekanos teams --help\")',\n ' reviewers Who decides agent reply drafts, for the Source admin:',\n ' list | add <email> --reach source|team [--team <slug>] |',\n ' remove <email> [--team <slug>]',\n \" routes Route a Source connection's events to teams, for the Source admin:\",\n ' list [<product>] | options <product> | set <product> <value> <team>',\n ' [--label <name>] | remove <product> <value> | webhook <product>',\n ' [--webhook <id>] (URL shown once) | unrouted [<product>] |',\n ' replay <event-id>',\n \" agents The source's agent templates, held by Ekanos:\",\n ' init [<dir>] [--claude|--no-claude] (skills + docs MCP for designing',\n ' agents with Claude; offers to add the docs to Claude Code)',\n ' list | show <key> | pull <key> [--out <dir>]',\n ' apply <dir|file> [--base-version <n>] [--overwrite]',\n ' publish <key> [--to <n>] --yes | rollback <key> --to <n> --yes',\n ' test <key> --team <slug> (--prompt \"…\" | --input <file.json>)',\n ' [--follow] (runs the latest, unpublished version on one team;',\n ' same grant, policy, approvals and audit; marked as a test)',\n ' apply also pushes <dir>/skills/<slug>/ folders first and names',\n ' them in the agent (--no-skills skips that)',\n ' Edit one template in place (stores a draft version; --publish',\n ' also rolls it out, with --yes):',\n ' policy <key> [set <tool> auto|approve | unset <tool>]',\n ' [--reads auto|approve] [--writes auto|approve]',\n ' triggers <key> [list | add event <k> --event <slug.event>',\n ' [--filter field=a,b]... | add schedule <k> --cron \"<expr>\"',\n ' [--timezone <tz>] --prompt <text> | add webhook <k> --prompt',\n ' <text> | remove <k>] [--prompt <text>] [--disabled]',\n ' links <key> [list | add <to-key> --kind talk|delegate',\n ' [--mode await|handoff] | remove <to-key> [--kind <kind>]]',\n ' overrides <key> [enable|disable policy|triggers|links]',\n ' (off: teams follow the template exactly; on: teams keep',\n ' their own differences)',\n \" skills The source's skills (SKILL.md folders), held by Ekanos:\",\n ' list [--team <t>] | show <slug> [--team <t>] |',\n ' push <dir> [--team <t>] (a new version, live at once; created',\n ' on first push, \"unchanged\" when identical; --team: that team\\'s',\n ' own skill, no other team sees it) | pull <slug> [--out <dir>]',\n \" knowledge The Source's Knowledge base (markdown articles), for the Source admin:\",\n ' list [--team <t>] | push <dir> [--team <t>] (each .md file an',\n ' article: title from frontmatter or the first heading, tags from',\n ' frontmatter; upserts by path, \"unchanged\" when identical) |',\n \" search <query> --team <t> (as that team's agents search: its\",\n ' articles plus General) | pull [--team <t>] [--out <dir>]',\n ' Without --team: the General collection every team reads.',\n \" runs Run and inspect a team's agents, as the Source admin:\",\n ' start <agent-key> --team <slug> (--prompt \"…\" | --input',\n ' <file.json>) [--follow] | list --team <slug> [--agent <key>] |',\n ' show <run-id> --team <slug> (--json: transcript, tool calls,',\n ' how each was authorized, approvals)',\n \" approvals What a team's agent runs wait on: list --team <slug> |\",\n ' approve|reject <id> --team <slug> [--reason \"…\"] |',\n ' edit <id> --team <slug> --body <file> (edit & send a reply draft)',\n ' use Set this project\\'s publish target (\"ekanos use <source-slug>\")',\n ' publish Validate, pack and submit the integration to an Ekanos host',\n ' upgrade Move this toolchain to a coherent target version, with',\n ' verify-and-rollback (--check --yes --no-verify --host <url>)',\n '',\n 'Keeping the toolchain current:',\n ' validate, dev and publish all check for a newer @ekanos/cli in the',\n ' background (never blocking, silenced by EKANOS_NO_UPDATE_CHECK) and warn',\n ' on stderr when one exists. Run \"ekanos upgrade --check\" any time a',\n ' validate finding smells like version skew (an unrecognized-key error you',\n ' are confident is correct) — it is read-only and safe to run freely. A',\n ' bare \"ekanos upgrade\" MUTATES the project (installs the target versions,',\n ' verifies with validate + the test script, rolls back on any failure).',\n '',\n 'Host resolution (logout, whoami, status, sources, catalog, apps, teams, reviewers, routes, agents, skills, knowledge, runs, approvals, use, publish, upgrade):',\n ' --host, else EKANOS_HOST, else the \"host\" field in ekanos.json, else the',\n ' sole stored login. \"ekanos publish\" saves host and source to ekanos.json.',\n ' \"ekanos login\" never reads ekanos.json for a host (--host, else',\n ' EKANOS_HOST, else the sole stored login) — it is the verb that creates',\n ' credentials, so a committed file must never choose where they go.',\n '',\n 'Publish targeting (see \"ekanos sources\" / \"ekanos use\"):',\n ' publish refuses (FORBIDDEN) a source you hold no seat on. With multiple',\n ' seats and an implicit (ekanos.json) source, a human run asks to confirm',\n ' the target; a scripted/JSON run needs --source or --yes to proceed —',\n ' it never prompts and never guesses.',\n '',\n 'Global options:',\n ' --json Emit a single JSON envelope on stdout (auto-on when piped);',\n ' --no-json forces the human-readable form',\n ' --version Print the CLI version',\n ' --help Show this help',\n].join('\\n');\n\nexport interface RunOptions {\n stdout?: WriteStream;\n stderr?: WriteStream;\n env?: Record<string, string | undefined>;\n cwd?: string;\n /**\n * Test-only override for `publish`'s interactive-confirm gate and `init`\n * / `login`'s clack wizard gate (`canWizard` in `wizard.ts`) — see\n * `PublishArgs` in `commands/publish.ts`. Never set this from real CLI\n * wiring; it exists so a test can exercise the human y/N confirm branch or\n * the wizard flow without a real terminal.\n */\n stdinIsTTY?: boolean;\n confirm?: (question: string) => Promise<boolean>;\n /** Test-only answers for `apps set` / `teams app set` questions — never set from real CLI wiring. */\n ask?: (question: string) => Promise<string>;\n askSecret?: (question: string) => Promise<string>;\n /**\n * Test-only override for `status --watch`'s poll delay — see `StatusArgs`\n * in `commands/status.ts`. Never set this from real CLI wiring; it exists\n * so a test can exercise the poll loop without waiting 30s per iteration.\n */\n sleep?: (ms: number) => Promise<void>;\n /**\n * Test-only override for `status`'s AGE column (\"now\") — see `StatusArgs`\n * in `commands/status.ts`. Never set this from real CLI wiring; it exists\n * so a test can assert an exact `relativeTime` string deterministically.\n */\n now?: Date;\n}\n\n/**\n * The single entry point. Resolves the agent-native envelope once, dispatches\n * to a verb, and guarantees exactly one terminal emission (success or error).\n * Returns the process exit code — `bin.ts` is the only place that calls\n * `process.exit`, so this stays fully testable.\n */\nexport async function run(\n argv: readonly string[],\n options: RunOptions = {},\n): Promise<number> {\n const jsonFlag = scanJsonFlag(argv);\n const ctx = new CliContext({\n jsonFlag,\n stdout: options.stdout,\n stderr: options.stderr,\n env: options.env,\n });\n const cwd = options.cwd ?? process.cwd();\n const env = options.env ?? process.env;\n\n try {\n // `--version` is global and verb-independent, so it is answered before the\n // command is even resolved: `ekanos --version` and `ekanos validate\n // --version` both report the tool's version and exit 0.\n if (scanFlagPresence(argv, 'version')) {\n return emitVersion(ctx);\n }\n\n const { command, rest } = splitCommand(argv);\n\n // Top-level help / no command.\n if (!command) {\n if (scanFlagPresence(rest, 'help') || argv.length === 0) {\n return emitHelp(ctx);\n }\n // A leading token that is not a command (e.g. `--nonsense`).\n ctx.emitClaudeCodeHint({\n tool: 'ekanos',\n error: 'unknown-command',\n commands: COMMANDS,\n usage: USAGE,\n });\n throw usageError(\n `Unknown command or flag \"${argv[0]}\".`,\n `Run one of: ${COMMANDS.join(', ')}. See \"ekanos --help\".`,\n );\n }\n\n if (!COMMANDS.includes(command)) {\n ctx.emitClaudeCodeHint({\n tool: 'ekanos',\n error: 'unknown-command',\n given: command,\n commands: COMMANDS,\n usage: USAGE,\n });\n throw usageError(\n `Unknown command \"${command}\".`,\n `Run one of: ${COMMANDS.join(', ')}. See \"ekanos --help\".`,\n );\n }\n\n const specs: FlagSpecs = { ...GLOBAL_SPECS, ...COMMAND_SPECS[command] };\n const parsed = parseArgv(rest, specs);\n\n if (parsed.flags.help === true) {\n return emitCommandHelp(ctx, command);\n }\n\n const positionalNames = POSITIONAL_COMMANDS[command] ?? [];\n\n if (positionalNames.length === 0 && parsed.positionals.length > 0) {\n throw usageError(\n `\"${command}\" takes no positional arguments (got \"${parsed.positionals[0]}\").`,\n `Pass options as flags, e.g. \"--dir <path>\". See \"ekanos ${command} --help\".`,\n );\n }\n\n if (parsed.positionals.length > positionalNames.length) {\n const usage = positionalNames.map((name) => `<${name}>`).join(' ');\n throw usageError(\n `\"${command}\" takes at most ${positionalNames.length} positional ` +\n `argument${positionalNames.length === 1 ? '' : 's'} (${usage}), ` +\n `got ${parsed.positionals.length}.`,\n `e.g. \"ekanos ${command} ${usage}\". See \"ekanos ${command} --help\".`,\n );\n }\n\n const dir = (parsed.flags.dir as string | undefined) ?? cwd;\n\n switch (command) {\n case 'init':\n return await runInit(ctx, {\n slug: parsed.flags.slug as string | undefined,\n dir: parsed.flags.dir as string | undefined,\n cwd,\n force: parsed.flags.force === true,\n yes: parsed.flags.yes === true,\n docs: parsed.flags.docs as string[] | undefined,\n stdinIsTTY: options.stdinIsTTY,\n });\n case 'validate':\n return await runValidate(ctx, { dir, env });\n case 'dev':\n return await runDev(ctx, {\n dir,\n port: parsed.flags.port as string | undefined,\n host: parsed.flags.host as string | undefined,\n force: parsed.flags.force === true,\n start: parsed.flags.start as boolean | undefined,\n env,\n });\n case 'test':\n return await runTest(ctx, {\n dir,\n passthrough: parsed.passthrough,\n raw: parsed.flags.raw === true,\n });\n case 'login':\n return await runLogin(ctx, {\n host: parsed.flags.host as string | undefined,\n force: parsed.flags.force === true,\n claude: parsed.flags.claude as boolean | undefined,\n cwd,\n env,\n stdinIsTTY: options.stdinIsTTY,\n });\n case 'logout':\n return await runLogout(ctx, {\n host: parsed.flags.host as string | undefined,\n all: parsed.flags.all === true,\n cwd,\n env,\n });\n case 'whoami':\n return await runWhoami(ctx, {\n host: parsed.flags.host as string | undefined,\n cwd,\n env,\n });\n case 'status':\n return await runStatus(ctx, {\n host: parsed.flags.host as string | undefined,\n dir,\n env,\n findings: parsed.flags.findings === true,\n all: parsed.flags.all === true,\n watch: parsed.flags.watch === true,\n sleep: options.sleep,\n now: options.now,\n });\n case 'sources':\n return await runSources(ctx, {\n host: parsed.flags.host as string | undefined,\n positionals: parsed.positionals,\n source: parsed.flags.source as string | undefined,\n yes: parsed.flags.yes === true,\n dir,\n env,\n });\n case 'catalog':\n return await runCatalog(ctx, {\n host: parsed.flags.host as string | undefined,\n source: parsed.flags.source as string | undefined,\n product: parsed.positionals[0],\n dir,\n env,\n });\n case 'apps':\n return await runApps(ctx, {\n host: parsed.flags.host as string | undefined,\n source: parsed.flags.source as string | undefined,\n subcommand: parsed.positionals[0],\n product: parsed.positionals[1],\n dir,\n env,\n stdinIsTTY: options.stdinIsTTY,\n ask: options.ask,\n askSecret: options.askSecret,\n confirm: options.confirm,\n noWait: parsed.flags['no-wait'] === true,\n });\n case 'teams':\n return await runTeams(ctx, {\n host: parsed.flags.host as string | undefined,\n source: parsed.flags.source as string | undefined,\n positionals: parsed.positionals,\n connection: parsed.flags.connection as string | undefined,\n slug: parsed.flags.slug as string | undefined,\n owner: parsed.flags.owner as string | undefined,\n role: parsed.flags.role as string | undefined,\n yes: parsed.flags.yes === true,\n noWait: parsed.flags['no-wait'] === true,\n noOpen: parsed.flags.open === false,\n linkOnly: parsed.flags['link-only'] === true,\n flags: parsed.flags,\n dir,\n env,\n stdinIsTTY: options.stdinIsTTY,\n ask: options.ask,\n askSecret: options.askSecret,\n });\n case 'reviewers':\n return await runReviewers(ctx, {\n host: parsed.flags.host as string | undefined,\n source: parsed.flags.source as string | undefined,\n positionals: parsed.positionals,\n reach: parsed.flags.reach as string | undefined,\n team: parsed.flags.team as string | undefined,\n dir,\n env,\n });\n case 'routes':\n return await runRoutes(ctx, {\n host: parsed.flags.host as string | undefined,\n source: parsed.flags.source as string | undefined,\n positionals: parsed.positionals,\n label: parsed.flags.label as string | undefined,\n webhook: parsed.flags.webhook as string | undefined,\n dir,\n env,\n });\n case 'agents':\n return await runAgents(ctx, {\n host: parsed.flags.host as string | undefined,\n source: parsed.flags.source as string | undefined,\n subcommand: parsed.positionals[0],\n target: parsed.positionals[1],\n to: parsed.flags.to as string | undefined,\n baseVersion: parsed.flags['base-version'] as string | undefined,\n overwrite: parsed.flags.overwrite === true,\n out: parsed.flags.out as string | undefined,\n yes: parsed.flags.yes === true,\n force: parsed.flags.force === true,\n claude: parsed.flags.claude as boolean | undefined,\n skills: parsed.flags.skills as boolean | undefined,\n rest: parsed.positionals.slice(2),\n event: parsed.flags.event as string | undefined,\n filter: parsed.flags.filter as string[] | undefined,\n disabled: parsed.flags.disabled === true,\n cron: parsed.flags.cron as string | undefined,\n timezone: parsed.flags.timezone as string | undefined,\n kind: parsed.flags.kind as string | undefined,\n mode: parsed.flags.mode as string | undefined,\n reads: parsed.flags.reads as string | undefined,\n writes: parsed.flags.writes as string | undefined,\n publish: parsed.flags.publish === true,\n dir,\n env,\n stdinIsTTY: options.stdinIsTTY,\n confirm: options.confirm,\n team: parsed.flags.team as string | undefined,\n prompt: parsed.flags.prompt as string | undefined,\n input: parsed.flags.input as string | undefined,\n follow: parsed.flags.follow === true,\n });\n case 'runs':\n case 'approvals':\n return await (command === 'runs' ? runRuns : runApprovals)(ctx, {\n host: parsed.flags.host as string | undefined,\n source: parsed.flags.source as string | undefined,\n positionals: parsed.positionals,\n team: parsed.flags.team as string | undefined,\n agent: parsed.flags.agent as string | undefined,\n prompt: parsed.flags.prompt as string | undefined,\n input: parsed.flags.input as string | undefined,\n follow: parsed.flags.follow === true,\n reason: parsed.flags.reason as string | undefined,\n body: parsed.flags.body as string | undefined,\n dir,\n env,\n sleep: options.sleep,\n });\n case 'skills':\n return await runSkills(ctx, {\n host: parsed.flags.host as string | undefined,\n source: parsed.flags.source as string | undefined,\n subcommand: parsed.positionals[0],\n target: parsed.positionals[1],\n team: parsed.flags.team as string | undefined,\n out: parsed.flags.out as string | undefined,\n dir,\n env,\n });\n case 'knowledge':\n return await runKnowledge(ctx, {\n host: parsed.flags.host as string | undefined,\n source: parsed.flags.source as string | undefined,\n subcommand: parsed.positionals[0],\n target: parsed.positionals[1],\n team: parsed.flags.team as string | undefined,\n out: parsed.flags.out as string | undefined,\n dir,\n env,\n });\n case 'use':\n return await runUse(ctx, {\n host: parsed.flags.host as string | undefined,\n dir,\n slug: parsed.positionals[0],\n env,\n });\n case 'publish':\n return await runPublish(ctx, {\n host: parsed.flags.host as string | undefined,\n source: parsed.flags.source as string | undefined,\n dir,\n yes: parsed.flags.yes === true,\n env,\n stdinIsTTY: options.stdinIsTTY,\n confirm: options.confirm,\n });\n case 'upgrade':\n return await runUpgrade(ctx, {\n dir,\n host: parsed.flags.host as string | undefined,\n env,\n check: parsed.flags.check === true,\n yes: parsed.flags.yes === true,\n noVerify: parsed.flags.verify === false,\n stdinIsTTY: options.stdinIsTTY,\n confirm: options.confirm,\n });\n default:\n // Unreachable — COMMANDS gate above — but keeps the switch total.\n throw usageError(\n `Unknown command \"${command}\".`,\n `Run one of: ${COMMANDS.join(', ')}.`,\n );\n }\n } catch (error) {\n return ctx.fail(toCliError(error));\n }\n}\n\n/**\n * Presence of `--json` (or `--no-json`) BEFORE the first `--` passthrough.\n *\n * Tri-state on purpose. `undefined` means \"the user expressed no preference\",\n * which is what lets the context fall back to inferring the mode from a\n * non-TTY stdout or CLAUDECODE. Collapsing `--no-json` to `false` here would\n * make it indistinguishable from absence, and the flag could then never turn\n * JSON mode OFF in exactly the cases it exists for.\n */\nfunction scanJsonFlag(argv: readonly string[]): boolean | undefined {\n for (const token of argv) {\n if (token === '--') break;\n if (token === '--json') return true;\n if (token === '--no-json') return false;\n }\n return undefined;\n}\n\nfunction scanFlagPresence(argv: readonly string[], name: string): boolean {\n for (const token of argv) {\n if (token === '--') break;\n if (token === `--${name}`) return true;\n }\n return false;\n}\n\n/**\n * Split argv into the command (first bare token before `--`) and the rest\n * (everything else, order preserved, including global flags and the `--`\n * passthrough). Global flags are all booleans, so any bare token is the\n * command — no value-consumption ambiguity.\n */\nfunction splitCommand(argv: readonly string[]): {\n command: string | null;\n rest: string[];\n} {\n for (let i = 0; i < argv.length; i++) {\n const token = argv[i]!;\n if (token === '--') break;\n if (!token.startsWith('-')) {\n return {\n command: token,\n rest: [...argv.slice(0, i), ...argv.slice(i + 1)],\n };\n }\n }\n return { command: null, rest: [...argv] };\n}\n\n/**\n * The CLI's own version, read from the package manifest at runtime rather than\n * baked in by the build — one source of truth, so a release bump cannot leave\n * `--version` reporting a stale number. The path resolves identically from\n * `src/index.ts` and from the emitted `dist/index.js`, both of which sit one\n * directory below the package root.\n */\nfunction readVersion(): string {\n const manifest = new URL('../package.json', import.meta.url);\n const parsed: unknown = JSON.parse(fs.readFileSync(manifest, 'utf8'));\n\n return typeof parsed === 'object' &&\n parsed !== null &&\n 'version' in parsed &&\n typeof parsed.version === 'string'\n ? parsed.version\n : '0.0.0';\n}\n\nfunction emitVersion(ctx: CliContext): number {\n const version = readVersion();\n\n return ctx.succeed({ name: 'ekanos', version }, version);\n}\n\nconst DOCS_FOOTER = `\\nDocs: ${SDK_DOCS_URL} (commands: ${docsPage('cli/commands')})`;\n\nfunction emitHelp(ctx: CliContext): number {\n ctx.emitClaudeCodeHint({\n tool: 'ekanos',\n commands: COMMANDS,\n usage: USAGE,\n exitCodes: EXIT_CODES,\n });\n return ctx.succeed(\n { usage: USAGE, commands: COMMANDS, docs: SDK_DOCS_URL },\n `${USAGE}${DOCS_FOOTER}`,\n );\n}\n\nfunction emitCommandHelp(ctx: CliContext, command: string): number {\n const specs = COMMAND_SPECS[command] ?? {};\n const flags = Object.keys(specs).map((name) => `--${name}`);\n const help = `Usage: ekanos ${command} [${flags.join('] [')}]`;\n ctx.emitClaudeCodeHint({ tool: 'ekanos', command, flags });\n return ctx.succeed({ command, flags }, help);\n}\n"]}
@@ -0,0 +1,129 @@
1
+ import { z } from 'zod';
2
+ declare const ArticleSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ slug: z.ZodString;
5
+ title: z.ZodString;
6
+ tags: z.ZodArray<z.ZodString>;
7
+ version: z.ZodNumber;
8
+ updatedAt: z.ZodString;
9
+ body: z.ZodOptional<z.ZodString>;
10
+ }, z.core.$strip>;
11
+ export type KnowledgeArticle = z.infer<typeof ArticleSchema>;
12
+ export declare const KnowledgeListSchema: z.ZodObject<{
13
+ source: z.ZodObject<{
14
+ id: z.ZodString;
15
+ slug: z.ZodString;
16
+ name: z.ZodNullable<z.ZodString>;
17
+ }, z.core.$strip>;
18
+ team: z.ZodNullable<z.ZodObject<{
19
+ slug: z.ZodString;
20
+ name: z.ZodString;
21
+ }, z.core.$strip>>;
22
+ articles: z.ZodArray<z.ZodObject<{
23
+ id: z.ZodString;
24
+ slug: z.ZodString;
25
+ title: z.ZodString;
26
+ tags: z.ZodArray<z.ZodString>;
27
+ version: z.ZodNumber;
28
+ updatedAt: z.ZodString;
29
+ body: z.ZodOptional<z.ZodString>;
30
+ }, z.core.$strip>>;
31
+ }, z.core.$strip>;
32
+ export type KnowledgeList = z.infer<typeof KnowledgeListSchema>;
33
+ declare const PushResultSchema: z.ZodObject<{
34
+ slug: z.ZodString;
35
+ id: z.ZodOptional<z.ZodString>;
36
+ status: z.ZodEnum<{
37
+ created: "created";
38
+ refused: "refused";
39
+ unchanged: "unchanged";
40
+ updated: "updated";
41
+ }>;
42
+ version: z.ZodOptional<z.ZodNumber>;
43
+ message: z.ZodOptional<z.ZodString>;
44
+ }, z.core.$strip>;
45
+ export type KnowledgePushResult = z.infer<typeof PushResultSchema>;
46
+ export declare const KnowledgePushSchema: z.ZodObject<{
47
+ source: z.ZodObject<{
48
+ id: z.ZodString;
49
+ slug: z.ZodString;
50
+ name: z.ZodNullable<z.ZodString>;
51
+ }, z.core.$strip>;
52
+ team: z.ZodNullable<z.ZodObject<{
53
+ slug: z.ZodString;
54
+ name: z.ZodString;
55
+ }, z.core.$strip>>;
56
+ results: z.ZodArray<z.ZodObject<{
57
+ slug: z.ZodString;
58
+ id: z.ZodOptional<z.ZodString>;
59
+ status: z.ZodEnum<{
60
+ created: "created";
61
+ refused: "refused";
62
+ unchanged: "unchanged";
63
+ updated: "updated";
64
+ }>;
65
+ version: z.ZodOptional<z.ZodNumber>;
66
+ message: z.ZodOptional<z.ZodString>;
67
+ }, z.core.$strip>>;
68
+ }, z.core.$strip>;
69
+ export type KnowledgePush = z.infer<typeof KnowledgePushSchema>;
70
+ declare const HitSchema: z.ZodObject<{
71
+ id: z.ZodString;
72
+ slug: z.ZodString;
73
+ title: z.ZodString;
74
+ tags: z.ZodArray<z.ZodString>;
75
+ collection: z.ZodEnum<{
76
+ general: "general";
77
+ team: "team";
78
+ }>;
79
+ snippet: z.ZodString;
80
+ rank: z.ZodNumber;
81
+ updatedAt: z.ZodString;
82
+ }, z.core.$strip>;
83
+ export type KnowledgeHit = z.infer<typeof HitSchema>;
84
+ export declare const KnowledgeSearchSchema: z.ZodObject<{
85
+ source: z.ZodObject<{
86
+ id: z.ZodString;
87
+ slug: z.ZodString;
88
+ name: z.ZodNullable<z.ZodString>;
89
+ }, z.core.$strip>;
90
+ team: z.ZodNullable<z.ZodObject<{
91
+ slug: z.ZodString;
92
+ name: z.ZodString;
93
+ }, z.core.$strip>>;
94
+ query: z.ZodString;
95
+ results: z.ZodArray<z.ZodObject<{
96
+ id: z.ZodString;
97
+ slug: z.ZodString;
98
+ title: z.ZodString;
99
+ tags: z.ZodArray<z.ZodString>;
100
+ collection: z.ZodEnum<{
101
+ general: "general";
102
+ team: "team";
103
+ }>;
104
+ snippet: z.ZodString;
105
+ rank: z.ZodNumber;
106
+ updatedAt: z.ZodString;
107
+ }, z.core.$strip>>;
108
+ }, z.core.$strip>;
109
+ export interface KnowledgePushArticle {
110
+ slug: string;
111
+ title: string;
112
+ body: string;
113
+ tags?: string[];
114
+ }
115
+ /** Articles per POST; the host refuses more. */
116
+ export declare const KNOWLEDGE_PUSH_BATCH = 50;
117
+ export type KnowledgeApiResult<T> = {
118
+ status: 'ok';
119
+ data: T;
120
+ } | {
121
+ status: 'unauthorized';
122
+ };
123
+ export declare function knowledgeCall<T>(host: string, accessToken: string, schema: z.ZodType<T>, init: {
124
+ method: 'GET' | 'POST';
125
+ path?: string;
126
+ query: Record<string, string | undefined>;
127
+ body?: unknown;
128
+ }): Promise<KnowledgeApiResult<T>>;
129
+ export {};
@@ -0,0 +1,138 @@
1
+ import { z } from 'zod';
2
+ import { request } from './auth/ekanos-api.js';
3
+ import { authRequiredError, forbiddenError, networkError, notFoundError, usageError, } from './errors.js';
4
+ /**
5
+ * The CLI's client for a Source's Knowledge (plan 244): the General
6
+ * collection every team reads, and each team's own.
7
+ *
8
+ * GET /api/partner/knowledge?source=<slug>[&team=<slug>][&body=1]
9
+ * POST /api/partner/knowledge { source, team?, articles: [...] }
10
+ * GET /api/partner/knowledge/search?source=<slug>&team=<slug>&q=<query>[&limit=<n>]
11
+ *
12
+ * → 401 / 3xx refresh once and retry
13
+ * → 403 { code: "SOURCE_ADMIN_REQUIRED" | "MFA_REQUIRED" | "FORBIDDEN" }
14
+ * → 404 { code: "TEAM_NOT_FOUND" | "SOURCE_NOT_FOUND" }
15
+ * → 400 { code: "INVALID_KNOWLEDGE" | "TEAM_REQUIRED" | "QUERY_REQUIRED" }
16
+ *
17
+ * The contract's shapes live here rather than in `@ekanos/integration-schema`,
18
+ * so the knowledge commands ship with the CLI alone.
19
+ */
20
+ const SourceRefSchema = z.object({
21
+ id: z.string(),
22
+ slug: z.string(),
23
+ name: z.string().nullable(),
24
+ });
25
+ const TeamRefSchema = z
26
+ .object({ slug: z.string(), name: z.string() })
27
+ .nullable();
28
+ const ArticleSchema = z.object({
29
+ id: z.string(),
30
+ slug: z.string(),
31
+ title: z.string(),
32
+ tags: z.array(z.string()),
33
+ version: z.number(),
34
+ updatedAt: z.string(),
35
+ body: z.string().optional(),
36
+ });
37
+ export const KnowledgeListSchema = z.object({
38
+ source: SourceRefSchema,
39
+ team: TeamRefSchema,
40
+ articles: z.array(ArticleSchema),
41
+ });
42
+ const PushResultSchema = z.object({
43
+ slug: z.string(),
44
+ id: z.string().optional(),
45
+ status: z.enum(['created', 'updated', 'unchanged', 'refused']),
46
+ version: z.number().optional(),
47
+ message: z.string().optional(),
48
+ });
49
+ export const KnowledgePushSchema = z.object({
50
+ source: SourceRefSchema,
51
+ team: TeamRefSchema,
52
+ results: z.array(PushResultSchema),
53
+ });
54
+ const HitSchema = z.object({
55
+ id: z.string(),
56
+ slug: z.string(),
57
+ title: z.string(),
58
+ tags: z.array(z.string()),
59
+ collection: z.enum(['team', 'general']),
60
+ snippet: z.string(),
61
+ rank: z.number(),
62
+ updatedAt: z.string(),
63
+ });
64
+ export const KnowledgeSearchSchema = z.object({
65
+ source: SourceRefSchema,
66
+ team: TeamRefSchema,
67
+ query: z.string(),
68
+ results: z.array(HitSchema),
69
+ });
70
+ /** Articles per POST; the host refuses more. */
71
+ export const KNOWLEDGE_PUSH_BATCH = 50;
72
+ const BASE = '/api/partner/knowledge';
73
+ export async function knowledgeCall(host, accessToken, schema, init) {
74
+ var _a;
75
+ const query = Object.fromEntries(Object.entries(init.query).filter((entry) => entry[1] !== undefined));
76
+ const url = `${host}${BASE}${(_a = init.path) !== null && _a !== void 0 ? _a : ''}?${new URLSearchParams(query)}`;
77
+ const response = await request(url, {
78
+ method: init.method,
79
+ headers: Object.assign({ accept: 'application/json', authorization: `Bearer ${accessToken}` }, (init.body === undefined
80
+ ? {}
81
+ : { 'content-type': 'application/json' })),
82
+ body: init.body === undefined ? undefined : JSON.stringify(init.body),
83
+ });
84
+ if (response.status === 401 ||
85
+ (response.status >= 300 && response.status < 400)) {
86
+ return { status: 'unauthorized' };
87
+ }
88
+ const body = await readOptionalJson(response);
89
+ const code = typeof body.code === 'string' ? body.code : null;
90
+ const message = typeof body.error === 'string' && body.error ? body.error : null;
91
+ if (response.status === 403 && code === 'MFA_REQUIRED') {
92
+ throw authRequiredError(message !== null && message !== void 0 ? message : `${host} requires multi-factor authentication.`, 'Complete MFA in the browser, then run "ekanos login" again.');
93
+ }
94
+ if (response.status === 403) {
95
+ throw forbiddenError(message !== null && message !== void 0 ? message : 'Not permitted on this Source.', code === 'SOURCE_ADMIN_REQUIRED'
96
+ ? 'Only a Source admin manages Knowledge from the CLI. Ask one to run it.'
97
+ : 'Run "ekanos sources" to list the sources you hold a seat on.');
98
+ }
99
+ if (response.status === 404) {
100
+ throw notFoundError(message !== null && message !== void 0 ? message : 'Not found.', code === 'TEAM_NOT_FOUND'
101
+ ? 'Run "ekanos teams list" to see the teams on this Source.'
102
+ : 'Run "ekanos sources" to list the sources you hold a seat on.');
103
+ }
104
+ if (response.status === 400) {
105
+ const issues = Array.isArray(body.issues)
106
+ ? body.issues
107
+ .map((issue) => `${String(issue.path)}: ${String(issue.message)}`)
108
+ .join('; ')
109
+ : null;
110
+ throw usageError([message !== null && message !== void 0 ? message : 'The host refused the request.', issues]
111
+ .filter(Boolean)
112
+ .join(' — '), code === 'TEAM_REQUIRED'
113
+ ? 'Pass --team <slug>: search runs as that team sees it.'
114
+ : 'See "ekanos knowledge --help".');
115
+ }
116
+ if (!response.ok) {
117
+ throw networkError(`${host}${BASE} responded ${response.status}.`, response.status >= 500
118
+ ? 'The Ekanos deployment returned a server error. Retry shortly.'
119
+ : 'Confirm the host runs a build that includes the knowledge route.');
120
+ }
121
+ const parsed = schema.safeParse(body.data);
122
+ if (!parsed.success) {
123
+ throw networkError(`${host}${BASE} answered in a shape this CLI does not read.`, 'Run "ekanos upgrade" — the CLI and the host disagree on the knowledge contract.');
124
+ }
125
+ return { status: 'ok', data: parsed.data };
126
+ }
127
+ async function readOptionalJson(response) {
128
+ try {
129
+ const parsed = await response.json();
130
+ return typeof parsed === 'object' && parsed !== null
131
+ ? parsed
132
+ : {};
133
+ }
134
+ catch (_a) {
135
+ return {};
136
+ }
137
+ }
138
+ //# sourceMappingURL=knowledge-api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge-api.js","sourceRoot":"","sources":["../src/knowledge-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,aAAa,EACb,UAAU,GACX,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAC;AAEH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AAG,IAAI,GAAG,IAAI,cAAc,QAAQ,CAAC,MAAM,GAAG,EAC9C,QAAQ,CAAC,MAAM,IAAI,GAAG;YACpB,CAAC,CAAC,+DAA+D;YACjE,CAAC,CAAC,kEAAkE,CACvE,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,YAAY,CAChB,GAAG,IAAI,GAAG,IAAI,8CAA8C,EAC5D,iFAAiF,CAClF,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AAC7C,CAAC;AAED,KAAK,UAAU,gBAAgB,CAC7B,QAAkB;IAElB,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC9C,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;YAClD,CAAC,CAAE,MAAkC;YACrC,CAAC,CAAC,EAAE,CAAC;IACT,CAAC;eAAO,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC","sourcesContent":["import { z } from 'zod';\n\nimport { request } from './auth/ekanos-api';\nimport {\n authRequiredError,\n forbiddenError,\n networkError,\n notFoundError,\n usageError,\n} from './errors';\n\n/**\n * The CLI's client for a Source's Knowledge (plan 244): the General\n * collection every team reads, and each team's own.\n *\n * GET /api/partner/knowledge?source=<slug>[&team=<slug>][&body=1]\n * POST /api/partner/knowledge { source, team?, articles: [...] }\n * GET /api/partner/knowledge/search?source=<slug>&team=<slug>&q=<query>[&limit=<n>]\n *\n * → 401 / 3xx refresh once and retry\n * → 403 { code: \"SOURCE_ADMIN_REQUIRED\" | \"MFA_REQUIRED\" | \"FORBIDDEN\" }\n * → 404 { code: \"TEAM_NOT_FOUND\" | \"SOURCE_NOT_FOUND\" }\n * → 400 { code: \"INVALID_KNOWLEDGE\" | \"TEAM_REQUIRED\" | \"QUERY_REQUIRED\" }\n *\n * The contract's shapes live here rather than in `@ekanos/integration-schema`,\n * so the knowledge commands ship with the CLI alone.\n */\n\nconst SourceRefSchema = z.object({\n id: z.string(),\n slug: z.string(),\n name: z.string().nullable(),\n});\n\nconst TeamRefSchema = z\n .object({ slug: z.string(), name: z.string() })\n .nullable();\n\nconst ArticleSchema = z.object({\n id: z.string(),\n slug: z.string(),\n title: z.string(),\n tags: z.array(z.string()),\n version: z.number(),\n updatedAt: z.string(),\n body: z.string().optional(),\n});\nexport type KnowledgeArticle = z.infer<typeof ArticleSchema>;\n\nexport const KnowledgeListSchema = z.object({\n source: SourceRefSchema,\n team: TeamRefSchema,\n articles: z.array(ArticleSchema),\n});\nexport type KnowledgeList = z.infer<typeof KnowledgeListSchema>;\n\nconst PushResultSchema = z.object({\n slug: z.string(),\n id: z.string().optional(),\n status: z.enum(['created', 'updated', 'unchanged', 'refused']),\n version: z.number().optional(),\n message: z.string().optional(),\n});\nexport type KnowledgePushResult = z.infer<typeof PushResultSchema>;\n\nexport const KnowledgePushSchema = z.object({\n source: SourceRefSchema,\n team: TeamRefSchema,\n results: z.array(PushResultSchema),\n});\nexport type KnowledgePush = z.infer<typeof KnowledgePushSchema>;\n\nconst HitSchema = z.object({\n id: z.string(),\n slug: z.string(),\n title: z.string(),\n tags: z.array(z.string()),\n collection: z.enum(['team', 'general']),\n snippet: z.string(),\n rank: z.number(),\n updatedAt: z.string(),\n});\nexport type KnowledgeHit = z.infer<typeof HitSchema>;\n\nexport const KnowledgeSearchSchema = z.object({\n source: SourceRefSchema,\n team: TeamRefSchema,\n query: z.string(),\n results: z.array(HitSchema),\n});\n\nexport interface KnowledgePushArticle {\n slug: string;\n title: string;\n body: string;\n tags?: string[];\n}\n\n/** Articles per POST; the host refuses more. */\nexport const KNOWLEDGE_PUSH_BATCH = 50;\n\nexport type KnowledgeApiResult<T> =\n | { status: 'ok'; data: T }\n | { status: 'unauthorized' };\n\nconst BASE = '/api/partner/knowledge';\n\nexport async function knowledgeCall<T>(\n host: string,\n accessToken: string,\n schema: z.ZodType<T>,\n init: {\n method: 'GET' | 'POST';\n path?: string;\n query: Record<string, string | undefined>;\n body?: unknown;\n },\n): Promise<KnowledgeApiResult<T>> {\n const query = Object.fromEntries(\n Object.entries(init.query).filter(\n (entry): entry is [string, string] => entry[1] !== undefined,\n ),\n );\n const url = `${host}${BASE}${init.path ?? ''}?${new URLSearchParams(query)}`;\n const response = await request(url, {\n method: init.method,\n headers: {\n accept: 'application/json',\n authorization: `Bearer ${accessToken}`,\n ...(init.body === undefined\n ? {}\n : { 'content-type': 'application/json' }),\n },\n body: init.body === undefined ? undefined : JSON.stringify(init.body),\n });\n\n if (\n response.status === 401 ||\n (response.status >= 300 && response.status < 400)\n ) {\n return { status: 'unauthorized' };\n }\n\n const body = await readOptionalJson(response);\n const code = typeof body.code === 'string' ? body.code : null;\n const message =\n typeof body.error === 'string' && body.error ? body.error : null;\n\n if (response.status === 403 && code === 'MFA_REQUIRED') {\n throw authRequiredError(\n message ?? `${host} requires multi-factor authentication.`,\n 'Complete MFA in the browser, then run \"ekanos login\" again.',\n );\n }\n if (response.status === 403) {\n throw forbiddenError(\n message ?? 'Not permitted on this Source.',\n code === 'SOURCE_ADMIN_REQUIRED'\n ? 'Only a Source admin manages Knowledge from the CLI. Ask one to run it.'\n : 'Run \"ekanos sources\" to list the sources you hold a seat on.',\n );\n }\n if (response.status === 404) {\n throw notFoundError(\n message ?? 'Not found.',\n code === 'TEAM_NOT_FOUND'\n ? 'Run \"ekanos teams list\" to see the teams on this Source.'\n : 'Run \"ekanos sources\" to list the sources you hold a seat on.',\n );\n }\n if (response.status === 400) {\n const issues = Array.isArray(body.issues)\n ? (body.issues as { path?: unknown; message?: unknown }[])\n .map((issue) => `${String(issue.path)}: ${String(issue.message)}`)\n .join('; ')\n : null;\n throw usageError(\n [message ?? 'The host refused the request.', issues]\n .filter(Boolean)\n .join(' — '),\n code === 'TEAM_REQUIRED'\n ? 'Pass --team <slug>: search runs as that team sees it.'\n : 'See \"ekanos knowledge --help\".',\n );\n }\n if (!response.ok) {\n throw networkError(\n `${host}${BASE} responded ${response.status}.`,\n response.status >= 500\n ? 'The Ekanos deployment returned a server error. Retry shortly.'\n : 'Confirm the host runs a build that includes the knowledge route.',\n );\n }\n\n const parsed = schema.safeParse(body.data);\n if (!parsed.success) {\n throw networkError(\n `${host}${BASE} answered in a shape this CLI does not read.`,\n 'Run \"ekanos upgrade\" — the CLI and the host disagree on the knowledge contract.',\n );\n }\n return { status: 'ok', data: parsed.data };\n}\n\nasync function readOptionalJson(\n response: Response,\n): Promise<Record<string, unknown>> {\n try {\n const parsed: unknown = await response.json();\n return typeof parsed === 'object' && parsed !== null\n ? (parsed as Record<string, unknown>)\n : {};\n } catch {\n return {};\n }\n}\n"]}