@ekanos/cli 0.28.0 → 0.29.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 (39) hide show
  1. package/README.md +5 -1
  2. package/dist/auth/ekanos-api.d.ts +8 -1
  3. package/dist/auth/ekanos-api.js +14 -2
  4. package/dist/auth/ekanos-api.js.map +1 -1
  5. package/dist/bin.js +4 -1
  6. package/dist/bin.js.map +1 -1
  7. package/dist/commands/feedback.d.ts +38 -0
  8. package/dist/commands/feedback.js +234 -0
  9. package/dist/commands/feedback.js.map +1 -0
  10. package/dist/commands/sources.js +4 -1
  11. package/dist/commands/sources.js.map +1 -1
  12. package/dist/context.d.ts +10 -0
  13. package/dist/context.js +10 -0
  14. package/dist/context.js.map +1 -1
  15. package/dist/feedback-api.d.ts +70 -0
  16. package/dist/feedback-api.js +111 -0
  17. package/dist/feedback-api.js.map +1 -0
  18. package/dist/feedback-context.d.ts +31 -0
  19. package/dist/feedback-context.js +209 -0
  20. package/dist/feedback-context.js.map +1 -0
  21. package/dist/feedback-updates.d.ts +16 -0
  22. package/dist/feedback-updates.js +174 -0
  23. package/dist/feedback-updates.js.map +1 -0
  24. package/dist/http-trace.d.ts +19 -0
  25. package/dist/http-trace.js +47 -0
  26. package/dist/http-trace.js.map +1 -0
  27. package/dist/index.d.ts +12 -0
  28. package/dist/index.js +143 -10
  29. package/dist/index.js.map +1 -1
  30. package/dist/last-error.d.ts +17 -0
  31. package/dist/last-error.js +56 -0
  32. package/dist/last-error.js.map +1 -0
  33. package/package.json +2 -2
  34. package/templates/AGENTS.md.tmpl +19 -0
  35. package/templates/claude-skill.md.tmpl +18 -0
  36. package/templates/experience/package.json.tmpl +4 -4
  37. package/templates/package.json.tmpl +4 -4
  38. package/templates/skills/build-agent/SKILL.md +18 -0
  39. package/templates/skills/build-integration/SKILL.md +18 -0
@@ -0,0 +1,17 @@
1
+ export interface LastError {
2
+ failedAt: string;
3
+ cliVersion: string;
4
+ /** The host the command reached last, if it reached one. */
5
+ host: string | null;
6
+ command: string | null;
7
+ flags: string[];
8
+ errorCode: string | null;
9
+ exitCode: number;
10
+ httpStatus: number | null;
11
+ requestId: string | null;
12
+ }
13
+ export declare function lastErrorPath(env: Record<string, string | undefined>): string;
14
+ /** Replace the record. Best effort: a failure to write never changes a run. */
15
+ export declare function writeLastError(env: Record<string, string | undefined>, record: LastError): void;
16
+ /** The recorded failure, or null when there is none or it is unreadable. */
17
+ export declare function readLastError(env: Record<string, string | undefined>): LastError | null;
@@ -0,0 +1,56 @@
1
+ import * as fs from 'node:fs';
2
+ import * as path from 'node:path';
3
+ import { resolveEkanosHome } from './auth/credential-store.js';
4
+ /**
5
+ * The last command that failed, kept for `ekanos feedback --last-error`:
6
+ * one small file, `~/.ekanos/last-error.json`, mode 0600, holding the most
7
+ * recent failure only. It holds what a report may carry and nothing else —
8
+ * the command path, flag names, codes, the host's status and request id —
9
+ * never an argument, a value, an error message (messages name the values
10
+ * they were given) or anything read from a file or the environment.
11
+ *
12
+ * Written only after a failure, read only by `ekanos feedback`. Never sent
13
+ * anywhere unless a report is filed with it.
14
+ */
15
+ const FILENAME = 'last-error.json';
16
+ const DIR_MODE = 0o700;
17
+ const FILE_MODE = 0o600;
18
+ export function lastErrorPath(env) {
19
+ return path.join(resolveEkanosHome(env), '.ekanos', FILENAME);
20
+ }
21
+ /** Replace the record. Best effort: a failure to write never changes a run. */
22
+ export function writeLastError(env, record) {
23
+ const target = lastErrorPath(env);
24
+ try {
25
+ fs.mkdirSync(path.dirname(target), { recursive: true, mode: DIR_MODE });
26
+ const tmp = `${target}.${process.pid}.tmp`;
27
+ fs.writeFileSync(tmp, `${JSON.stringify(record)}\n`, { mode: FILE_MODE });
28
+ if (process.platform !== 'win32')
29
+ fs.chmodSync(tmp, FILE_MODE);
30
+ fs.renameSync(tmp, target);
31
+ }
32
+ catch (_a) {
33
+ // A courtesy for a later report, not a record anyone depends on.
34
+ }
35
+ }
36
+ /** The recorded failure, or null when there is none or it is unreadable. */
37
+ export function readLastError(env) {
38
+ try {
39
+ const parsed = JSON.parse(fs.readFileSync(lastErrorPath(env), 'utf8'));
40
+ return isLastError(parsed) ? parsed : null;
41
+ }
42
+ catch (_a) {
43
+ return null;
44
+ }
45
+ }
46
+ function isLastError(value) {
47
+ if (typeof value !== 'object' || value === null)
48
+ return false;
49
+ const candidate = value;
50
+ return (typeof candidate.failedAt === 'string' &&
51
+ typeof candidate.cliVersion === 'string' &&
52
+ Array.isArray(candidate.flags) &&
53
+ candidate.flags.every((flag) => typeof flag === 'string') &&
54
+ typeof candidate.exitCode === 'number');
55
+ }
56
+ //# sourceMappingURL=last-error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"last-error.js","sourceRoot":"","sources":["../src/last-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D;;;;;;;;;;GAUG;AAEH,MAAM,QAAQ,GAAG,iBAAiB,CAAC;AACnC,MAAM,QAAQ,GAAG,KAAK,CAAC;AACvB,MAAM,SAAS,GAAG,KAAK,CAAC;AAexB,MAAM,UAAU,aAAa,CAAC,GAAuC;IACnE,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAChE,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,cAAc,CAC5B,GAAuC,EACvC,MAAiB;IAEjB,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,CAAC;QACH,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;QACxE,MAAM,GAAG,GAAG,GAAG,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C;AACJ,CAAC","sourcesContent":["import * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport { resolveEkanosHome } from './auth/credential-store';\n\n/**\n * The last command that failed, kept for `ekanos feedback --last-error`:\n * one small file, `~/.ekanos/last-error.json`, mode 0600, holding the most\n * recent failure only. It holds what a report may carry and nothing else —\n * the command path, flag names, codes, the host's status and request id —\n * never an argument, a value, an error message (messages name the values\n * they were given) or anything read from a file or the environment.\n *\n * Written only after a failure, read only by `ekanos feedback`. Never sent\n * anywhere unless a report is filed with it.\n */\n\nconst FILENAME = 'last-error.json';\nconst DIR_MODE = 0o700;\nconst FILE_MODE = 0o600;\n\nexport interface LastError {\n failedAt: string;\n cliVersion: string;\n /** The host the command reached last, if it reached one. */\n host: string | null;\n command: string | null;\n flags: string[];\n errorCode: string | null;\n exitCode: number;\n httpStatus: number | null;\n requestId: string | null;\n}\n\nexport function lastErrorPath(env: Record<string, string | undefined>): string {\n return path.join(resolveEkanosHome(env), '.ekanos', FILENAME);\n}\n\n/** Replace the record. Best effort: a failure to write never changes a run. */\nexport function writeLastError(\n env: Record<string, string | undefined>,\n record: LastError,\n): void {\n const target = lastErrorPath(env);\n try {\n fs.mkdirSync(path.dirname(target), { recursive: true, mode: DIR_MODE });\n const tmp = `${target}.${process.pid}.tmp`;\n fs.writeFileSync(tmp, `${JSON.stringify(record)}\\n`, { mode: FILE_MODE });\n if (process.platform !== 'win32') fs.chmodSync(tmp, FILE_MODE);\n fs.renameSync(tmp, target);\n } catch {\n // A courtesy for a later report, not a record anyone depends on.\n }\n}\n\n/** The recorded failure, or null when there is none or it is unreadable. */\nexport function readLastError(\n env: Record<string, string | undefined>,\n): LastError | null {\n try {\n const parsed: unknown = JSON.parse(\n fs.readFileSync(lastErrorPath(env), 'utf8'),\n );\n return isLastError(parsed) ? parsed : null;\n } catch {\n return null;\n }\n}\n\nfunction isLastError(value: unknown): value is LastError {\n if (typeof value !== 'object' || value === null) return false;\n const candidate = value as Partial<LastError>;\n return (\n typeof candidate.failedAt === 'string' &&\n typeof candidate.cliVersion === 'string' &&\n Array.isArray(candidate.flags) &&\n candidate.flags.every((flag) => typeof flag === 'string') &&\n typeof candidate.exitCode === 'number'\n );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ekanos/cli",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "private": false,
5
5
  "description": "The Ekanos partner toolchain CLI: scaffold, validate, and test an Ekanos integration against the published @ekanos packages. Agent-native — every verb speaks JSON with a stable exit-code taxonomy.",
6
6
  "keywords": [
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@clack/prompts": "1.9.0",
38
- "@ekanos/integration-schema": "0.33.0",
38
+ "@ekanos/integration-schema": "0.34.0",
39
39
  "esbuild": "0.28.2",
40
40
  "picocolors": "1.1.1"
41
41
  },
@@ -635,6 +635,25 @@ carries an imperative `hint`; treat hints as remediation instructions.
635
635
  | `ekanos use <source-slug>` | Set this project's publish target — refuses (`forbidden`) a slug you hold no seat on |
636
636
  | `ekanos publish` | Validate, pack (whitelist: ekanos.json, package.json, README.md, src/), verify the target, and submit. Refuses on any error-severity finding |
637
637
  | `ekanos upgrade` | Move this project's toolchain to a coherent target version, with verify-and-rollback |
638
+ | `ekanos feedback` | Report a problem with the CLI or the platform to Vastly (`--last-error` attaches the failed command's context, never its values) |
639
+
640
+ ### Reporting a problem to Vastly
641
+
642
+ When an `ekanos` command fails unexpectedly, a message is confusing, or
643
+ something sends you to the app instead of the CLI, file it; that is how it
644
+ gets fixed. Say what you tried, what happened and what you expected:
645
+
646
+ ```bash
647
+ npx ekanos feedback --last-error "<what you were trying to do>"
648
+ npx ekanos feedback "<what you tried, what happened, what you expected>" --kind confusing
649
+ ```
650
+
651
+ `--last-error` attaches the failed command's path, flag names, error code and
652
+ the host's request id, never a value. A failed command's `claude-code-hint`
653
+ line names the exact command to run. Never put secrets, tokens or customer
654
+ data in the message: it is redacted before it is sent, but do not rely on
655
+ that. Nothing is sent unless you run it. When the fix ships, a later command
656
+ says so, once; `npx ekanos feedback list` shows your reports.
638
657
 
639
658
  ### Keeping the toolchain current
640
659
 
@@ -94,6 +94,24 @@ publish target — pass `--source` or `--yes`, never guess) · `4` run
94
94
  `@ekanos/integration-schema` is newer than this CLI bundles — run
95
95
  `ekanos upgrade`) · `10` fix findings, publish again.
96
96
 
97
+ ## Reporting a problem to Vastly
98
+
99
+ When an `ekanos` command fails unexpectedly, a message is confusing, or
100
+ something sends you to the app instead of the CLI, file it; that is how it
101
+ gets fixed. Say what you tried, what happened and what you expected:
102
+
103
+ ```bash
104
+ npx ekanos feedback --last-error "<what you were trying to do>"
105
+ npx ekanos feedback "<what you tried, what happened, what you expected>" --kind confusing
106
+ ```
107
+
108
+ `--last-error` attaches the failed command's path, flag names, error code and
109
+ the host's request id, never a value. A failed command's `claude-code-hint`
110
+ line names the exact command to run. Never put secrets, tokens or customer
111
+ data in the message: it is redacted before it is sent, but do not rely on
112
+ that. Nothing is sent unless you run it. When the fix ships, a later command
113
+ says so, once; `npx ekanos feedback list` shows your reports.
114
+
97
115
  ## Hosts and sessions
98
116
 
99
117
  `ekanos login --host <url>` stores a session; after that, `logout`/`whoami`/
@@ -22,16 +22,16 @@
22
22
  "build": "npx ekanos build"
23
23
  },
24
24
  "dependencies": {
25
- "@ekanos/sdk": "^0.33.0",
26
- "@ekanos/ui": "^0.33.0",
25
+ "@ekanos/sdk": "^0.34.0",
26
+ "@ekanos/ui": "^0.34.0",
27
27
  "@tanstack/react-query": "^5.101.4",
28
28
  "react": "^19.2.8",
29
29
  "react-dom": "^19.2.8",
30
30
  "zod": "^4.6.7"
31
31
  },
32
32
  "devDependencies": {
33
- "@ekanos/cli": "^0.28.0",
34
- "@ekanos/harness": "^0.33.0",
33
+ "@ekanos/cli": "^0.29.0",
34
+ "@ekanos/harness": "^0.34.0",
35
35
  "@tailwindcss/postcss": "^4.3.3",
36
36
  "@typescript-eslint/parser": "^8.46.2",
37
37
  "@types/react": "^19.2.0",
@@ -12,12 +12,12 @@
12
12
  "prepare": "node scripts/setup-hooks.mjs"
13
13
  },
14
14
  "dependencies": {
15
- "@ekanos/sdk": "^0.33.0",
16
- "@ekanos/ui": "^0.33.0"
15
+ "@ekanos/sdk": "^0.34.0",
16
+ "@ekanos/ui": "^0.34.0"
17
17
  },
18
18
  "devDependencies": {
19
- "@ekanos/cli": "^0.28.0",
20
- "@ekanos/harness": "^0.33.0",
19
+ "@ekanos/cli": "^0.29.0",
20
+ "@ekanos/harness": "^0.34.0",
21
21
  "@hookform/resolvers": "^5.2.2",
22
22
  "@tailwindcss/postcss": "^4.3.3",
23
23
  "@tanstack/react-query": "^5.101.4",
@@ -346,3 +346,21 @@ names them). Add `--json` for a stable record a script can assert on.
346
346
 
347
347
  Never approve on the user's behalf without asking: show them what the agent
348
348
  proposes (`approvals list`) and decide only on their word.
349
+
350
+ ## Reporting a problem to Vastly
351
+
352
+ When an `ekanos` command fails unexpectedly, a message is confusing, or
353
+ something sends you to the app instead of the CLI, file it; that is how it
354
+ gets fixed. Say what you tried, what happened and what you expected:
355
+
356
+ ```bash
357
+ npx @ekanos/cli feedback --last-error "<what you were trying to do>"
358
+ npx @ekanos/cli feedback "<what you tried, what happened, what you expected>" --kind confusing
359
+ ```
360
+
361
+ `--last-error` attaches the failed command's path, flag names, error code and
362
+ the host's request id, never a value. A failed command's `claude-code-hint`
363
+ line names the exact command to run. Never put secrets, tokens or customer
364
+ data in the message: it is redacted before it is sent, but do not rely on
365
+ that. Nothing is sent unless you run it. When the fix ships, a later command
366
+ says so, once; `npx @ekanos/cli feedback list` shows your reports.
@@ -201,3 +201,21 @@ and re-confirm before retrying.
201
201
  exact output.
202
202
  - Never edit files under `.ekanos/` (generated) or weaken a test to get to
203
203
  green.
204
+
205
+ ## Reporting a problem to Vastly
206
+
207
+ When an `ekanos` command fails unexpectedly, a message is confusing, or
208
+ something sends you to the app instead of the CLI, file it; that is how it
209
+ gets fixed. Say what you tried, what happened and what you expected:
210
+
211
+ ```bash
212
+ npx @ekanos/cli feedback --last-error "<what you were trying to do>"
213
+ npx @ekanos/cli feedback "<what you tried, what happened, what you expected>" --kind confusing
214
+ ```
215
+
216
+ `--last-error` attaches the failed command's path, flag names, error code and
217
+ the host's request id, never a value. A failed command's `claude-code-hint`
218
+ line names the exact command to run. Never put secrets, tokens or customer
219
+ data in the message: it is redacted before it is sent, but do not rely on
220
+ that. Nothing is sent unless you run it. When the fix ships, a later command
221
+ says so, once; `npx @ekanos/cli feedback list` shows your reports.