@artis-lab/cli 0.14.0 → 0.16.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 (41) hide show
  1. package/README.md +28 -21
  2. package/package.json +3 -7
  3. package/src/bin.js +13 -4
  4. package/src/lib/app.js +13 -4
  5. package/src/lib/chunk-2GXGXTAO.js +1229 -0
  6. package/src/lib/{chunk-CT5TD6L2.js → chunk-2LRPXCLL.js} +24 -47
  7. package/src/lib/chunk-4O5BCFCD.js +60 -0
  8. package/src/lib/chunk-6PK46UOP.js +1804 -0
  9. package/src/lib/{chunk-MEPQKMK5.js → chunk-FSJVBXCW.js} +4 -32
  10. package/src/lib/{chunk-H32QAUSA.js → chunk-HUWOFEEU.js} +7 -0
  11. package/src/lib/chunk-I5P3FLKO.js +929 -0
  12. package/src/lib/chunk-IKQ5U3DH.js +146 -0
  13. package/src/lib/chunk-XZYT3B5O.js +113 -0
  14. package/src/lib/cli.js +87 -61
  15. package/src/lib/commands.js +25 -0
  16. package/src/lib/exit-codes.js +5 -3
  17. package/src/lib/files.js +3 -2
  18. package/src/lib/next-actions.js +12 -5
  19. package/src/lib/skill-install.js +9 -4
  20. package/src/lib/verify.js +2 -3
  21. package/src/bin.d.ts +0 -2
  22. package/src/index.d.ts +0 -1
  23. package/src/index.js +0 -76
  24. package/src/lib/app.d.ts +0 -3
  25. package/src/lib/args.d.ts +0 -4
  26. package/src/lib/args.js +0 -12
  27. package/src/lib/chunk-CCCATRMP.js +0 -591
  28. package/src/lib/chunk-KJV7R7DE.js +0 -82
  29. package/src/lib/chunk-PG7WDW5F.js +0 -2420
  30. package/src/lib/chunk-Q5KBGVKT.js +0 -155
  31. package/src/lib/chunk-QZFIUZXT.js +0 -10954
  32. package/src/lib/cli.d.ts +0 -147
  33. package/src/lib/config.d.ts +0 -50
  34. package/src/lib/exit-codes.d.ts +0 -28
  35. package/src/lib/files.d.ts +0 -19
  36. package/src/lib/next-actions.d.ts +0 -13
  37. package/src/lib/oauth.d.ts +0 -45
  38. package/src/lib/revision-bases.d.ts +0 -9
  39. package/src/lib/skill-install.d.ts +0 -50
  40. package/src/lib/verify.d.ts +0 -152
  41. package/src/lib/version.d.ts +0 -9
@@ -1,155 +0,0 @@
1
- import {
2
- hasFlag,
3
- parseFlagValue
4
- } from "./chunk-KJV7R7DE.js";
5
- import {
6
- exitCodes
7
- } from "./chunk-H32QAUSA.js";
8
-
9
- // packages/cli/src/lib/next-actions.ts
10
- function action(id, description, argv, args, kind = "suggestion", effect = "read") {
11
- const host = parseFlagValue(args, "--host") ?? parseFlagValue(args, "--url");
12
- return {
13
- id,
14
- description,
15
- argv: host ? [...argv, "--host", host] : argv,
16
- kind,
17
- effect
18
- };
19
- }
20
- function publishedActions(artifactId, args) {
21
- return [
22
- action(
23
- "read-feedback",
24
- "Read review feedback",
25
- ["artifact", "feedback", artifactId],
26
- args
27
- )
28
- ];
29
- }
30
- function feedbackActions(artifactId, cursor, openThreads, args) {
31
- const actions = [];
32
- if (openThreads > 0) {
33
- actions.push(
34
- action(
35
- "read-source",
36
- "List the current revision files before editing",
37
- ["artifact", "files", artifactId],
38
- args
39
- )
40
- );
41
- } else if (cursor !== void 0 && /^\d+$/.test(String(cursor))) {
42
- actions.push(
43
- action(
44
- "watch-feedback",
45
- "Wait up to 30s for new feedback",
46
- [
47
- "watch",
48
- artifactId,
49
- "--since",
50
- String(cursor),
51
- "--once",
52
- "--timeout",
53
- "30s"
54
- ],
55
- args
56
- )
57
- );
58
- }
59
- return actions;
60
- }
61
- function recoveryActions(code, args, route) {
62
- const help = (id, description, argv) => action(id, description, [...argv, "-h"], [], "recovery");
63
- switch (code) {
64
- case exitCodes.usage:
65
- return [help("usage", "Read the relevant command help", route)];
66
- case exitCodes.auth:
67
- return [
68
- action(
69
- "check-identity",
70
- "Check identity and permissions; login if credentials expired",
71
- ["whoami"],
72
- args,
73
- "recovery"
74
- )
75
- ];
76
- case exitCodes.revisionConflict:
77
- if (route[0] === "revise" && args[1]) {
78
- return [
79
- action(
80
- "read-latest",
81
- "Inspect latest files, download to a new path and reconcile before revising",
82
- ["artifact", "files", args[1]],
83
- args,
84
- "recovery"
85
- )
86
- ];
87
- }
88
- if (route[0] === "data" && args[2] && args[3] && ["set", "update", "delete"].includes(route[1])) {
89
- return [
90
- action(
91
- "read-latest",
92
- "Re-read the document and reapply the intended change before retrying",
93
- ["data", "get", args[2], args[3]],
94
- args,
95
- "recovery"
96
- )
97
- ];
98
- }
99
- return [
100
- help(
101
- "read-latest",
102
- "Re-read and reconcile the latest state before retrying",
103
- route
104
- )
105
- ];
106
- case exitCodes.notFound:
107
- return [
108
- help(
109
- "find-resource",
110
- "Check the resource ID and command arguments",
111
- route
112
- )
113
- ];
114
- case exitCodes.verifyFailed:
115
- return [
116
- help("verify", "Fix reported findings before publishing or revising", [
117
- "verify"
118
- ])
119
- ];
120
- default:
121
- return [];
122
- }
123
- }
124
- function displayArg(arg) {
125
- return /^[a-zA-Z0-9_./:@%+=,-]+$/.test(arg) ? arg : "'" + arg.replace(/'/g, "'\\''") + "'";
126
- }
127
- function renderNextActions(actions) {
128
- for (const item of actions) {
129
- console.error(
130
- `Next: artis ${item.argv.map(displayArg).join(" ")} \u2014 ${item.description}`
131
- );
132
- }
133
- }
134
- function renderResult(data, actions, args, agent) {
135
- const json = hasFlag(args, "--json");
136
- if (json) {
137
- console.log(
138
- JSON.stringify(
139
- agent && hasFlag(args, "--next") ? { data, nextActions: actions } : data,
140
- null,
141
- 2
142
- )
143
- );
144
- return true;
145
- }
146
- return false;
147
- }
148
-
149
- export {
150
- publishedActions,
151
- feedbackActions,
152
- recoveryActions,
153
- renderNextActions,
154
- renderResult
155
- };