mossbear 0.1.0-alpha.75 → 0.1.0-alpha.77

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 (171) hide show
  1. package/dist/commands/artifacts/index.d.ts +8 -0
  2. package/dist/commands/artifacts/index.d.ts.map +1 -0
  3. package/dist/commands/artifacts/index.js +22 -0
  4. package/dist/commands/artifacts/index.js.map +1 -0
  5. package/dist/commands/artifacts/remote.d.ts +138 -0
  6. package/dist/commands/artifacts/remote.d.ts.map +1 -0
  7. package/dist/commands/artifacts/remote.js +313 -0
  8. package/dist/commands/artifacts/remote.js.map +1 -0
  9. package/dist/commands/docs/index.d.ts +3 -1
  10. package/dist/commands/docs/index.d.ts.map +1 -1
  11. package/dist/commands/docs/index.js +4 -5
  12. package/dist/commands/docs/index.js.map +1 -1
  13. package/dist/commands/init.d.ts.map +1 -1
  14. package/dist/commands/init.js +7 -24
  15. package/dist/commands/init.js.map +1 -1
  16. package/dist/commands/lifecycle.d.ts +6 -0
  17. package/dist/commands/lifecycle.d.ts.map +1 -1
  18. package/dist/commands/lifecycle.js +7 -0
  19. package/dist/commands/lifecycle.js.map +1 -1
  20. package/dist/commands/mcp.js +1 -1
  21. package/dist/commands/mcp.js.map +1 -1
  22. package/dist/commands/narration.js +1 -1
  23. package/dist/commands/narration.js.map +1 -1
  24. package/dist/commands/unlink.d.ts +1 -1
  25. package/dist/commands/unlink.js +1 -1
  26. package/dist/commands/update.js +1 -1
  27. package/dist/commands/update.js.map +1 -1
  28. package/dist/commit-anchor.d.ts +8 -1
  29. package/dist/commit-anchor.d.ts.map +1 -1
  30. package/dist/commit-anchor.js +18 -0
  31. package/dist/commit-anchor.js.map +1 -1
  32. package/dist/config.d.ts +10 -2
  33. package/dist/config.d.ts.map +1 -1
  34. package/dist/config.js +90 -32
  35. package/dist/config.js.map +1 -1
  36. package/dist/docs/bundle-by-name.js +1 -1
  37. package/dist/docs/bundle-by-name.js.map +1 -1
  38. package/dist/docs/global-delivery-prompt.d.ts +2 -2
  39. package/dist/docs/global-delivery-prompt.d.ts.map +1 -1
  40. package/dist/docs/global-delivery-prompt.js +2 -2
  41. package/dist/docs/global-delivery-prompt.js.map +1 -1
  42. package/dist/docs/global-delivery.d.ts +10 -9
  43. package/dist/docs/global-delivery.d.ts.map +1 -1
  44. package/dist/docs/global-delivery.js +107 -36
  45. package/dist/docs/global-delivery.js.map +1 -1
  46. package/dist/docs/global-namespace.d.ts +27 -15
  47. package/dist/docs/global-namespace.d.ts.map +1 -1
  48. package/dist/docs/global-namespace.js +29 -7
  49. package/dist/docs/global-namespace.js.map +1 -1
  50. package/dist/docs/global-status.d.ts +1 -1
  51. package/dist/docs/global-status.js +1 -1
  52. package/dist/docs/sync-docs.js +2 -2
  53. package/dist/harness-formats/opencode.d.ts.map +1 -1
  54. package/dist/harness-formats/opencode.js +17 -5
  55. package/dist/harness-formats/opencode.js.map +1 -1
  56. package/dist/harness-manifest-schema.d.ts +5 -0
  57. package/dist/harness-manifest-schema.d.ts.map +1 -1
  58. package/dist/harness-manifest-schema.js +5 -0
  59. package/dist/harness-manifest-schema.js.map +1 -1
  60. package/dist/harness-writers.d.ts +1 -1
  61. package/dist/harness-writers.d.ts.map +1 -1
  62. package/dist/harness-writers.js +10 -15
  63. package/dist/harness-writers.js.map +1 -1
  64. package/dist/harnesses.d.ts +6 -0
  65. package/dist/harnesses.d.ts.map +1 -1
  66. package/dist/harnesses.js +7 -0
  67. package/dist/harnesses.js.map +1 -1
  68. package/dist/hooks-settings.d.ts +8 -3
  69. package/dist/hooks-settings.d.ts.map +1 -1
  70. package/dist/hooks-settings.js +17 -3
  71. package/dist/hooks-settings.js.map +1 -1
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +1 -0
  74. package/dist/index.js.map +1 -1
  75. package/dist/init/wire-harnesses.d.ts.map +1 -1
  76. package/dist/init/wire-harnesses.js +5 -13
  77. package/dist/init/wire-harnesses.js.map +1 -1
  78. package/dist/lifecycle/operations.d.ts +2 -0
  79. package/dist/lifecycle/operations.d.ts.map +1 -1
  80. package/dist/lifecycle/operations.js +35 -10
  81. package/dist/lifecycle/operations.js.map +1 -1
  82. package/dist/mcp/artifact-reference.d.ts +6 -0
  83. package/dist/mcp/artifact-reference.d.ts.map +1 -0
  84. package/dist/mcp/artifact-reference.js +35 -0
  85. package/dist/mcp/artifact-reference.js.map +1 -0
  86. package/dist/mcp/client.d.ts +56 -11
  87. package/dist/mcp/client.d.ts.map +1 -1
  88. package/dist/mcp/client.js +144 -19
  89. package/dist/mcp/client.js.map +1 -1
  90. package/dist/mcp/import-tool.d.ts +3 -3
  91. package/dist/mcp/import-tool.js +3 -3
  92. package/dist/mcp/item-url.d.ts +3 -0
  93. package/dist/mcp/item-url.d.ts.map +1 -1
  94. package/dist/mcp/item-url.js +5 -0
  95. package/dist/mcp/item-url.js.map +1 -1
  96. package/dist/mcp/server.d.ts +4 -8
  97. package/dist/mcp/server.d.ts.map +1 -1
  98. package/dist/mcp/server.js +195 -214
  99. package/dist/mcp/server.js.map +1 -1
  100. package/dist/mcp/write-items.d.ts +3 -0
  101. package/dist/mcp/write-items.d.ts.map +1 -1
  102. package/dist/mcp/write-items.js +1 -0
  103. package/dist/mcp/write-items.js.map +1 -1
  104. package/dist/repo-id.d.ts.map +1 -1
  105. package/dist/repo-id.js +3 -10
  106. package/dist/repo-id.js.map +1 -1
  107. package/dist/repository-identity.d.ts +7 -0
  108. package/dist/repository-identity.d.ts.map +1 -0
  109. package/dist/repository-identity.js +37 -0
  110. package/dist/repository-identity.js.map +1 -0
  111. package/dist/rules/bundled-skills.js +1 -1
  112. package/dist/rules/discover.d.ts.map +1 -1
  113. package/dist/rules/discover.js +6 -5
  114. package/dist/rules/discover.js.map +1 -1
  115. package/dist/rules/guide-history-client.d.ts +1 -1
  116. package/dist/rules/guide-history-client.js +1 -1
  117. package/dist/rules/import-paths.d.ts.map +1 -1
  118. package/dist/rules/import-paths.js +4 -17
  119. package/dist/rules/import-paths.js.map +1 -1
  120. package/dist/session-collection-policy.d.ts +6 -0
  121. package/dist/session-collection-policy.d.ts.map +1 -1
  122. package/dist/session-collection-policy.js +12 -1
  123. package/dist/session-collection-policy.js.map +1 -1
  124. package/dist/session-end.d.ts +2 -1
  125. package/dist/session-end.d.ts.map +1 -1
  126. package/dist/session-end.js +8 -2
  127. package/dist/session-end.js.map +1 -1
  128. package/dist/skill-template.d.ts +2 -2
  129. package/dist/skill-template.d.ts.map +1 -1
  130. package/dist/skill-template.js +12 -13
  131. package/dist/skill-template.js.map +1 -1
  132. package/dist/turn-capture-queue.d.ts +1 -1
  133. package/dist/turn-capture-queue.d.ts.map +1 -1
  134. package/dist/turn-capture-queue.js +41 -19
  135. package/dist/turn-capture-queue.js.map +1 -1
  136. package/dist/update/perform.d.ts.map +1 -1
  137. package/dist/update/perform.js +7 -2
  138. package/dist/update/perform.js.map +1 -1
  139. package/dist/usage/account.d.ts +19 -0
  140. package/dist/usage/account.d.ts.map +1 -0
  141. package/dist/usage/account.js +103 -0
  142. package/dist/usage/account.js.map +1 -0
  143. package/dist/usage/lifecycle-observations.d.ts +13 -0
  144. package/dist/usage/lifecycle-observations.d.ts.map +1 -0
  145. package/dist/usage/lifecycle-observations.js +48 -0
  146. package/dist/usage/lifecycle-observations.js.map +1 -0
  147. package/dist/usage/session-observation.d.ts +7 -0
  148. package/dist/usage/session-observation.d.ts.map +1 -0
  149. package/dist/usage/session-observation.js +8 -0
  150. package/dist/usage/session-observation.js.map +1 -0
  151. package/dist/usage/snapshot-state.d.ts +108 -1
  152. package/dist/usage/snapshot-state.d.ts.map +1 -1
  153. package/dist/usage/snapshot-state.js +35 -1
  154. package/dist/usage/snapshot-state.js.map +1 -1
  155. package/dist/usage/snapshots.d.ts +10 -7
  156. package/dist/usage/snapshots.d.ts.map +1 -1
  157. package/dist/usage/snapshots.js +83 -14
  158. package/dist/usage/snapshots.js.map +1 -1
  159. package/package.json +4 -4
  160. package/dist/commands/docs/remote.d.ts +0 -77
  161. package/dist/commands/docs/remote.d.ts.map +0 -1
  162. package/dist/commands/docs/remote.js +0 -188
  163. package/dist/commands/docs/remote.js.map +0 -1
  164. package/dist/context/read-item.d.ts +0 -176
  165. package/dist/context/read-item.d.ts.map +0 -1
  166. package/dist/context/read-item.js +0 -24
  167. package/dist/context/read-item.js.map +0 -1
  168. package/dist/mcp/item-reference.d.ts +0 -4
  169. package/dist/mcp/item-reference.d.ts.map +0 -1
  170. package/dist/mcp/item-reference.js +0 -23
  171. package/dist/mcp/item-reference.js.map +0 -1
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The `artifacts` group: every operation on a saved artifact by URL or id. One
3
+ * group for one object, whether it began as a document, a note or a guide's body.
4
+ * Each subcommand sends its write once and validates the response against the
5
+ * shared protocol schema.
6
+ */
7
+ export declare const artifactsCommand: import("citty").CommandDef<import("citty").ArgsDef>;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/artifacts/index.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,qDAa3B,CAAA"}
@@ -0,0 +1,22 @@
1
+ import { defineCommand } from 'citty';
2
+ /**
3
+ * The `artifacts` group: every operation on a saved artifact by URL or id. One
4
+ * group for one object, whether it began as a document, a note or a guide's body.
5
+ * Each subcommand sends its write once and validates the response against the
6
+ * shared protocol schema.
7
+ */
8
+ export const artifactsCommand = defineCommand({
9
+ meta: {
10
+ name: 'artifacts',
11
+ description: 'Read, create, update, file and archive Mossbear artifacts',
12
+ },
13
+ subCommands: {
14
+ read: () => import('./remote.js').then((m) => m.artifactsReadCommand),
15
+ create: () => import('./remote.js').then((m) => m.artifactsCreateCommand),
16
+ update: () => import('./remote.js').then((m) => m.artifactsUpdateCommand),
17
+ history: () => import('./remote.js').then((m) => m.artifactsHistoryCommand),
18
+ file: () => import('./remote.js').then((m) => m.artifactsFileCommand),
19
+ archive: () => import('./remote.js').then((m) => m.artifactsArchiveCommand),
20
+ },
21
+ });
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/artifacts/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAErC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAC;IAC5C,IAAI,EAAE;QACJ,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,2DAA2D;KACzE;IACD,WAAW,EAAE;QACX,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,oBAAoB,CAAC;QACrE,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,sBAAsB,CAAC;QACzE,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,sBAAsB,CAAC;QACzE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,uBAAuB,CAAC;QAC3E,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,oBAAoB,CAAC;QACrE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,uBAAuB,CAAC;KAC5E;CACF,CAAC,CAAA"}
@@ -0,0 +1,138 @@
1
+ export declare const artifactsReadCommand: import("citty").CommandDef<{
2
+ version: {
3
+ type: "string";
4
+ description: string;
5
+ };
6
+ json: {
7
+ type: "boolean";
8
+ default: boolean;
9
+ description: string;
10
+ };
11
+ 'dashboard-url': {
12
+ type: "string";
13
+ description: string;
14
+ };
15
+ artifact: {
16
+ type: "positional";
17
+ required: boolean;
18
+ description: string;
19
+ };
20
+ }>;
21
+ export declare const artifactsCreateCommand: import("citty").CommandDef<{
22
+ file: {
23
+ type: "string";
24
+ required: true;
25
+ description: string;
26
+ };
27
+ name: {
28
+ type: "string";
29
+ required: true;
30
+ description: string;
31
+ };
32
+ bundle: {
33
+ type: "string";
34
+ description: string;
35
+ };
36
+ json: {
37
+ type: "boolean";
38
+ default: boolean;
39
+ description: string;
40
+ };
41
+ 'dashboard-url': {
42
+ type: "string";
43
+ description: string;
44
+ };
45
+ }>;
46
+ export declare const artifactsUpdateCommand: import("citty").CommandDef<{
47
+ file: {
48
+ type: "string";
49
+ required: true;
50
+ description: string;
51
+ };
52
+ 'expected-version': {
53
+ type: "string";
54
+ required: true;
55
+ description: string;
56
+ };
57
+ json: {
58
+ type: "boolean";
59
+ default: boolean;
60
+ description: string;
61
+ };
62
+ 'dashboard-url': {
63
+ type: "string";
64
+ description: string;
65
+ };
66
+ artifact: {
67
+ type: "positional";
68
+ required: boolean;
69
+ description: string;
70
+ };
71
+ }>;
72
+ export declare const artifactsHistoryCommand: import("citty").CommandDef<{
73
+ before: {
74
+ type: "string";
75
+ description: string;
76
+ };
77
+ limit: {
78
+ type: "string";
79
+ description: string;
80
+ };
81
+ json: {
82
+ type: "boolean";
83
+ default: boolean;
84
+ description: string;
85
+ };
86
+ 'dashboard-url': {
87
+ type: "string";
88
+ description: string;
89
+ };
90
+ artifact: {
91
+ type: "positional";
92
+ required: boolean;
93
+ description: string;
94
+ };
95
+ }>;
96
+ export declare const artifactsFileCommand: import("citty").CommandDef<{
97
+ bundle: {
98
+ type: "string";
99
+ required: true;
100
+ description: string;
101
+ };
102
+ remove: {
103
+ type: "boolean";
104
+ default: false;
105
+ description: string;
106
+ };
107
+ json: {
108
+ type: "boolean";
109
+ default: boolean;
110
+ description: string;
111
+ };
112
+ 'dashboard-url': {
113
+ type: "string";
114
+ description: string;
115
+ };
116
+ artifact: {
117
+ type: "positional";
118
+ required: boolean;
119
+ description: string;
120
+ };
121
+ }>;
122
+ export declare const artifactsArchiveCommand: import("citty").CommandDef<{
123
+ json: {
124
+ type: "boolean";
125
+ default: boolean;
126
+ description: string;
127
+ };
128
+ 'dashboard-url': {
129
+ type: "string";
130
+ description: string;
131
+ };
132
+ artifact: {
133
+ type: "positional";
134
+ required: boolean;
135
+ description: string;
136
+ };
137
+ }>;
138
+ //# sourceMappingURL=remote.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../../src/commands/artifacts/remote.ts"],"names":[],"mappings":"AAmGA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;EAqC/B,CAAA;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;EAyCjC,CAAA;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;EAiDjC,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;EAoDlC,CAAA;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;EA2D/B,CAAA;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;EA2BlC,CAAA"}
@@ -0,0 +1,313 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { MAX_VERSIONS_LIMIT, printable } from '@mossbear/protocol';
3
+ import { defineCommand } from 'citty';
4
+ import { resolveCheckoutGitSource } from '../../commit-anchor.js';
5
+ import { resolveDashboardUrl, resolveToken } from '../../config.js';
6
+ import { bundleNameFailureMessage, resolveBundleByName, } from '../../docs/bundle-by-name.js';
7
+ import { readCheckoutProjectId } from '../../docs/repo-config.js';
8
+ import { errText } from '../../err-text.js';
9
+ import { positiveInteger, resolveArtifactReference, VERSION_HISTORY_NOTE, } from '../../mcp/artifact-reference.js';
10
+ import { ArtifactOutcomeUncertainError, ArtifactVersionConflictError, createContextClient, } from '../../mcp/client.js';
11
+ import { artifactUrl } from '../../mcp/item-url.js';
12
+ import { reportNoToken } from '../../no-token.js';
13
+ const sharedArgs = {
14
+ json: {
15
+ type: 'boolean',
16
+ default: false,
17
+ description: 'Print the validated response as JSON',
18
+ },
19
+ 'dashboard-url': {
20
+ type: 'string',
21
+ description: 'Override the dashboard base URL',
22
+ },
23
+ };
24
+ const referenceArg = {
25
+ artifact: {
26
+ type: 'positional',
27
+ required: true,
28
+ description: 'Artifact URL or id',
29
+ },
30
+ };
31
+ /**
32
+ * Credentials come from login or the environment, never from arguments: a
33
+ * pasted link chooses an identity and never the host the token is sent to.
34
+ */
35
+ async function connect(override, rawArgs) {
36
+ if (rawArgs.some((arg) => arg === '--token' || arg.startsWith('--token='))) {
37
+ throw new Error('Use mossbear login or MOSSBEAR_TOKEN in the environment; artifact commands do not accept tokens in arguments.');
38
+ }
39
+ const dashboardUrl = await resolveDashboardUrl(override);
40
+ const token = await resolveToken();
41
+ if (!token) {
42
+ reportNoToken();
43
+ return null;
44
+ }
45
+ return { client: createContextClient({ dashboardUrl, token }), dashboardUrl };
46
+ }
47
+ async function connectToArtifact(reference, override, rawArgs) {
48
+ // Parse the reference first so a malformed or foreign link fails before any
49
+ // request, and before a credential is looked up.
50
+ const dashboardUrl = await resolveDashboardUrl(override);
51
+ const artifactId = resolveArtifactReference(reference, dashboardUrl);
52
+ const conn = await connect(override, rawArgs);
53
+ return conn ? { ...conn, artifactId } : null;
54
+ }
55
+ function withUrl(artifact, dashboardUrl) {
56
+ return { ...artifact, url: artifactUrl(dashboardUrl, artifact.id) };
57
+ }
58
+ function fail(err) {
59
+ if (err instanceof ArtifactVersionConflictError) {
60
+ console.error(` This artifact is at v${err.currentVersion}, not v${err.expectedVersion}, so nothing was written. ` +
61
+ 'Read it again, merge your edit into the current content, and update with --expected-version ' +
62
+ `${err.currentVersion}.`);
63
+ }
64
+ else if (err instanceof ArtifactOutcomeUncertainError) {
65
+ console.error(` Outcome unknown. ${err.message}`);
66
+ }
67
+ else {
68
+ console.error(` ${errText(err)}`);
69
+ }
70
+ process.exitCode = 1;
71
+ }
72
+ export const artifactsReadCommand = defineCommand({
73
+ meta: {
74
+ name: 'read',
75
+ description: 'Read one artifact by URL or id, current or at a saved version',
76
+ },
77
+ args: {
78
+ ...referenceArg,
79
+ ...sharedArgs,
80
+ version: {
81
+ type: 'string',
82
+ description: 'Saved version number; omit for current content',
83
+ },
84
+ },
85
+ async run({ args, rawArgs }) {
86
+ try {
87
+ const version = positiveInteger(args.version, 'version');
88
+ const conn = await connectToArtifact(args.artifact, args['dashboard-url'], rawArgs);
89
+ if (!conn)
90
+ return;
91
+ const result = await conn.client.readArtifact(conn.artifactId, { version });
92
+ const artifact = withUrl(result.artifact, conn.dashboardUrl);
93
+ if (args.json) {
94
+ console.log(JSON.stringify({ ...result, artifact }, null, 2));
95
+ return;
96
+ }
97
+ console.log(`${printable(artifact.name)} v${artifact.version}` +
98
+ (result.revision.current ? '' : ` (showing saved v${result.revision.version})`));
99
+ console.log(artifact.content === null
100
+ ? ' Content is unavailable.'
101
+ : printable(artifact.content));
102
+ }
103
+ catch (err) {
104
+ fail(err);
105
+ }
106
+ },
107
+ });
108
+ export const artifactsCreateCommand = defineCommand({
109
+ meta: {
110
+ name: 'create',
111
+ description: 'Create an artifact from a file, optionally filed into a bundle',
112
+ },
113
+ args: {
114
+ ...sharedArgs,
115
+ file: {
116
+ type: 'string',
117
+ required: true,
118
+ description: 'UTF-8 file containing the content',
119
+ },
120
+ name: { type: 'string', required: true, description: 'Artifact name' },
121
+ bundle: {
122
+ type: 'string',
123
+ description: 'Destination bundle slug. Optional unless your credential is scoped to bundles',
124
+ },
125
+ },
126
+ async run({ args, rawArgs }) {
127
+ try {
128
+ const content = await readFile(args.file, 'utf8');
129
+ const conn = await connect(args['dashboard-url'], rawArgs);
130
+ if (!conn)
131
+ return;
132
+ const artifact = withUrl(await conn.client.createArtifact({
133
+ name: args.name,
134
+ content,
135
+ ...(args.bundle === undefined ? {} : { bundle: args.bundle }),
136
+ }), conn.dashboardUrl);
137
+ console.log(args.json
138
+ ? JSON.stringify({ artifact, created: true }, null, 2)
139
+ : `Created ${printable(artifact.name)} at v${artifact.version}.\n id: ${artifact.id}\n ${artifact.url}`);
140
+ }
141
+ catch (err) {
142
+ fail(err);
143
+ }
144
+ },
145
+ });
146
+ export const artifactsUpdateCommand = defineCommand({
147
+ meta: {
148
+ name: 'update',
149
+ description: 'Replace an artifact from a file, against the version you read',
150
+ },
151
+ args: {
152
+ ...referenceArg,
153
+ ...sharedArgs,
154
+ file: {
155
+ type: 'string',
156
+ required: true,
157
+ description: 'UTF-8 file containing the full replacement content',
158
+ },
159
+ 'expected-version': {
160
+ type: 'string',
161
+ required: true,
162
+ description: 'Current version actually read; a stale edit is refused',
163
+ },
164
+ },
165
+ async run({ args, rawArgs }) {
166
+ try {
167
+ const expectedVersion = positiveInteger(args['expected-version'], 'expected-version');
168
+ if (expectedVersion === undefined)
169
+ throw new Error('expected-version is required.');
170
+ const content = await readFile(args.file, 'utf8');
171
+ const conn = await connectToArtifact(args.artifact, args['dashboard-url'], rawArgs);
172
+ if (!conn)
173
+ return;
174
+ const projectId = await readCheckoutProjectId(process.cwd());
175
+ const gitSource = resolveCheckoutGitSource(process.cwd(), projectId);
176
+ const artifact = withUrl(await conn.client.updateArtifact(conn.artifactId, {
177
+ content,
178
+ expectedVersion,
179
+ ...(projectId === null ? {} : { projectId }),
180
+ ...(gitSource === undefined ? {} : { gitSource }),
181
+ }), conn.dashboardUrl);
182
+ console.log(args.json
183
+ ? JSON.stringify({ artifact, updated: true }, null, 2)
184
+ : `Updated ${printable(artifact.name)} to v${artifact.version}.\n ${artifact.url}`);
185
+ }
186
+ catch (err) {
187
+ fail(err);
188
+ }
189
+ },
190
+ });
191
+ export const artifactsHistoryCommand = defineCommand({
192
+ meta: {
193
+ name: 'history',
194
+ description: 'List saved versions of an artifact with hashes and pagination',
195
+ },
196
+ args: {
197
+ ...referenceArg,
198
+ ...sharedArgs,
199
+ before: {
200
+ type: 'string',
201
+ description: 'Return versions older than this one, from nextCursor',
202
+ },
203
+ limit: { type: 'string', description: `Page size, at most ${MAX_VERSIONS_LIMIT}` },
204
+ },
205
+ async run({ args, rawArgs }) {
206
+ try {
207
+ const before = positiveInteger(args.before, 'before');
208
+ const limit = positiveInteger(args.limit, 'limit', MAX_VERSIONS_LIMIT);
209
+ const conn = await connectToArtifact(args.artifact, args['dashboard-url'], rawArgs);
210
+ if (!conn)
211
+ return;
212
+ const history = await conn.client.artifactHistory(conn.artifactId, {
213
+ before,
214
+ limit,
215
+ });
216
+ if (args.json) {
217
+ console.log(JSON.stringify({
218
+ artifactId: conn.artifactId,
219
+ ...history,
220
+ historyNote: VERSION_HISTORY_NOTE,
221
+ }, null, 2));
222
+ return;
223
+ }
224
+ console.log(VERSION_HISTORY_NOTE);
225
+ for (const snapshot of history.versions) {
226
+ console.log(` v${snapshot.version} ${printable(snapshot.createdAt)} ${printable(snapshot.authorType)}`);
227
+ console.log(` ${printable(snapshot.id)} ${printable(snapshot.contentHash)}`);
228
+ }
229
+ if (!history.versions.length)
230
+ console.log(' No saved versions in this page.');
231
+ if (history.nextCursor !== null)
232
+ console.log(` More available: use --before ${history.nextCursor}`);
233
+ }
234
+ catch (err) {
235
+ fail(err);
236
+ }
237
+ },
238
+ });
239
+ export const artifactsFileCommand = defineCommand({
240
+ meta: {
241
+ name: 'file',
242
+ description: 'File an artifact into a bundle, or take it out with --remove',
243
+ },
244
+ args: {
245
+ ...referenceArg,
246
+ ...sharedArgs,
247
+ bundle: { type: 'string', required: true, description: 'Bundle slug' },
248
+ remove: {
249
+ type: 'boolean',
250
+ default: false,
251
+ description: 'Remove the artifact from the bundle instead of adding it',
252
+ },
253
+ },
254
+ async run({ args, rawArgs }) {
255
+ try {
256
+ const conn = await connectToArtifact(args.artifact, args['dashboard-url'], rawArgs);
257
+ if (!conn)
258
+ return;
259
+ // Resolved up front so a mistyped slug fails as itself: the detach route
260
+ // reads an unknown membership as "already absent".
261
+ const { bundles } = await conn.client.listBundles();
262
+ const resolved = resolveBundleByName(bundles, args.bundle);
263
+ if (!resolved.ok) {
264
+ throw new Error(bundleNameFailureMessage(args.bundle, resolved, { surface: 'cli' }));
265
+ }
266
+ const member = {
267
+ bundleId: resolved.bundle.id,
268
+ itemId: conn.artifactId,
269
+ itemType: 'guide_file',
270
+ };
271
+ const outcome = args.remove
272
+ ? { removed: (await conn.client.detachMember(member)).detached }
273
+ : { added: (await conn.client.attachMember(member)).attached };
274
+ if (args.json) {
275
+ console.log(JSON.stringify({ artifactId: conn.artifactId, bundle: args.bundle, ...outcome }, null, 2));
276
+ return;
277
+ }
278
+ console.log(args.remove
279
+ ? outcome.removed
280
+ ? `Removed from ${printable(args.bundle)}.`
281
+ : `Was not in ${printable(args.bundle)}.`
282
+ : outcome.added
283
+ ? `Filed into ${printable(args.bundle)}.`
284
+ : `Already in ${printable(args.bundle)}.`);
285
+ }
286
+ catch (err) {
287
+ fail(err);
288
+ }
289
+ },
290
+ });
291
+ export const artifactsArchiveCommand = defineCommand({
292
+ meta: {
293
+ name: 'archive',
294
+ description: 'Archive an artifact, taking it out of every bundle',
295
+ },
296
+ args: { ...referenceArg, ...sharedArgs },
297
+ async run({ args, rawArgs }) {
298
+ try {
299
+ const conn = await connectToArtifact(args.artifact, args['dashboard-url'], rawArgs);
300
+ if (!conn)
301
+ return;
302
+ const projectId = await readCheckoutProjectId(process.cwd());
303
+ const artifact = withUrl(await conn.client.archiveArtifact(conn.artifactId, projectId === null ? undefined : { projectId }), conn.dashboardUrl);
304
+ console.log(args.json
305
+ ? JSON.stringify({ artifact, archived: true }, null, 2)
306
+ : `Archived ${printable(artifact.name)}.`);
307
+ }
308
+ catch (err) {
309
+ fail(err);
310
+ }
311
+ },
312
+ });
313
+ //# sourceMappingURL=remote.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote.js","sourceRoot":"","sources":["../../../src/commands/artifacts/remote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAErC,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAA;AACjE,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EACL,wBAAwB,EACxB,mBAAmB,GACpB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAC3C,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EACL,6BAA6B,EAC7B,4BAA4B,EAC5B,mBAAmB,GACpB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAIjD,MAAM,UAAU,GAAG;IACjB,IAAI,EAAE;QACJ,IAAI,EAAE,SAAkB;QACxB,OAAO,EAAE,KAAK;QACd,WAAW,EAAE,sCAAsC;KACpD;IACD,eAAe,EAAE;QACf,IAAI,EAAE,QAAiB;QACvB,WAAW,EAAE,iCAAiC;KAC/C;CACF,CAAA;AAED,MAAM,YAAY,GAAG;IACnB,QAAQ,EAAE;QACR,IAAI,EAAE,YAAqB;QAC3B,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,oBAAoB;KAClC;CACF,CAAA;AAED;;;GAGG;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QAAQ,GAAG,OAAO,CACtB,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAC/B,IAAI,CAAC,UAAU,EACf,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAC/C,EACD,IAAI,CAAC,YAAY,CAClB,CAAA;YACD,OAAO,CAAC,GAAG,CACT,IAAI,CAAC,IAAI;gBACP,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;gBACvD,CAAC,CAAC,YAAY,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAC5C,CAAA;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,CAAC,GAAG,CAAC,CAAA;QACX,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * The `docs` group, following the `guides` precedent of a per-content-type
3
- * group (`docs-in-place-plan.md` → Naming). `relink` is its first member: the
3
+ * group (`docs-in-place-plan.md` → Naming). `relink` is its only member: the
4
4
  * declared fallback for a move `mossbear refresh` reports but refuses to assume.
5
+ * It rebinds a local file mapping and addresses no remote artifact, so it did
6
+ * not move into `artifacts` with the read and write operations.
5
7
  */
6
8
  export declare const docsCommand: import("citty").CommandDef<import("citty").ArgsDef>;
7
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/docs/index.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,WAAW,qDAWtB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/docs/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,qDAQtB,CAAA"}
@@ -1,18 +1,17 @@
1
1
  import { defineCommand } from 'citty';
2
2
  /**
3
3
  * The `docs` group, following the `guides` precedent of a per-content-type
4
- * group (`docs-in-place-plan.md` → Naming). `relink` is its first member: the
4
+ * group (`docs-in-place-plan.md` → Naming). `relink` is its only member: the
5
5
  * declared fallback for a move `mossbear refresh` reports but refuses to assume.
6
+ * It rebinds a local file mapping and addresses no remote artifact, so it did
7
+ * not move into `artifacts` with the read and write operations.
6
8
  */
7
9
  export const docsCommand = defineCommand({
8
10
  meta: {
9
11
  name: 'docs',
10
- description: 'Read, update and manage Mossbear documents',
12
+ description: 'Repair the local mapping of synced documents',
11
13
  },
12
14
  subCommands: {
13
- read: () => import('./remote.js').then((m) => m.docsReadCommand),
14
- history: () => import('./remote.js').then((m) => m.docsHistoryCommand),
15
- update: () => import('./remote.js').then((m) => m.docsUpdateCommand),
16
15
  relink: () => import('./relink.js').then((m) => m.docsRelinkCommand),
17
16
  },
18
17
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/docs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAErC;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;IACvC,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,4CAA4C;KAC1D;IACD,WAAW,EAAE;QACX,IAAI,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC;QAChE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC;QACtE,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC;QACpE,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC;KACrE;CACF,CAAC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/docs/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAErC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAC;IACvC,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,8CAA8C;KAC5D;IACD,WAAW,EAAE;QACX,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC;KACrE;CACF,CAAC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAieA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqxDtB,CAAA"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAgeA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuwDtB,CAAA"}
@@ -10,7 +10,7 @@ import { claudeMdBulkImportNote, isRootClaudeMd, offerClaudeMdImport, } from '..
10
10
  import { deliveryBundles, legacySubscribedSlugs, legacySubscriptionMessage, repoBundleIds, } from '../docs/delivery.js';
11
11
  import { ASK_GLOBAL_AGAIN, followsAccountLine, globalDeliveryPromptPlan, globalDeliveryQuestion, } from '../docs/global-delivery-prompt.js';
12
12
  import { accountGlobalDeliveryFrom, } from '../docs/global-delivery.js';
13
- import { agentsSkillsRoot, LAPTOP_DELIVERY_ROOTS, namespaceDir, } from '../docs/global-namespace.js';
13
+ import { agentsSkillsRoot, globalSkillsRoot, LAPTOP_DELIVERY_ROOTS, } from '../docs/global-namespace.js';
14
14
  import { readRepoDocsConfig, readRepoProjectId, readRepoWorkspaceId, writeRepoWorkspaceId, } from '../docs/repo-config.js';
15
15
  import { offerSkillTwins } from '../docs/skill-twins.js';
16
16
  import { resolveInitSubscriptionSelection, subscribeBundleSelections, } from '../docs/subscribe.js';
@@ -19,7 +19,7 @@ import { resolveWorkspaceDeclarationSelection, shareableWorkspaces, } from '../d
19
19
  import { errText } from '../err-text.js';
20
20
  import { CODEX_SESSION_START_EVENT } from '../harness-writers.js';
21
21
  import { DEFAULT_HARNESS_ID, detectHarnesses, harnessDefinition, harnessOffers, harnessReportLines, loggerCommand, parseHarnessSelection, parsePlatformFlag, resolveHarnessSelection, WRITABLE_HARNESSES, } from '../harnesses.js';
22
- import { MOSSBEAR_COMPLETE_COMMAND, MOSSBEAR_LEGACY_SESSION_START_YES_COMMAND, MOSSBEAR_REPORT_COMMAND, MOSSBEAR_SESSION_START_COMMAND, MOSSBEAR_SESSION_START_NO_UPDATE_COMMAND, guardedSessionStartCommand, hookGroupsHaveCommand, mergeMossbearHookEntry, mergeMossbearLoggerHook, missingHookPathWarning, pruneStaleHooks, sessionStartHookRefreshes, sessionStartSpellingNote, staleHookWarning, stopHookUploadsActions, } from '../hooks-settings.js';
22
+ import { MOSSBEAR_COMPLETE_COMMAND, MOSSBEAR_REPORT_COMMAND, guardedSessionStartCommand, hookGroupsHaveCommand, mergeMossbearHookEntry, mergeMossbearLoggerHook, missingHookPathWarning, pruneStaleHooks, sessionStartHookRefreshes, sessionStartSpellingNote, sessionStartCommand as stampedSessionStartCommand, supersededSessionStartCommands, staleHookWarning, stopHookUploadsActions, } from '../hooks-settings.js';
23
23
  import { summarizeNoOps } from '../init/no-ops.js';
24
24
  import { offerUserScopeMcp } from '../init/user-scope-mcp.js';
25
25
  import { wireHarness } from '../init/wire-harnesses.js';
@@ -962,30 +962,13 @@ export const initCommand = defineCommand({
962
962
  // Gated on `--session-start-hook`, and that gate is load-bearing rather
963
963
  // than tidy: declining the entry must not read as licence to delete the
964
964
  // one the repo already had and install nothing in its place.
965
- const sessionStartCommand = autoUpdate
966
- ? MOSSBEAR_SESSION_START_COMMAND
967
- : MOSSBEAR_SESSION_START_NO_UPDATE_COMMAND;
968
- const supersededSessionStartCommand = autoUpdate
969
- ? MOSSBEAR_SESSION_START_NO_UPDATE_COMMAND
970
- : MOSSBEAR_SESSION_START_COMMAND;
965
+ const sessionStartCommand = stampedSessionStartCommand('claude_code', autoUpdate);
971
966
  if (args['session-start-hook']) {
972
- const migration = pruneStaleHooks(hooks['SessionStart'], [
973
- supersededSessionStartCommand,
974
- // The `--yes` spelling this version stopped writing — superseded
975
- // regardless of which current spelling this run wants, so a
976
- // repo still carrying it gets rewritten either way.
977
- MOSSBEAR_LEGACY_SESSION_START_YES_COMMAND,
978
- ]);
967
+ const migration = pruneStaleHooks(hooks['SessionStart'], supersededSessionStartCommands('claude_code', autoUpdate));
979
968
  hooks['SessionStart'] = migration.groups;
980
969
  if (migration.removed > 0) {
981
970
  settingsChanged = true;
982
- // Named from what `pruneStaleHooks` actually found and removed
983
- // (`removedCommands`), not from `supersededSessionStartCommand`:
984
- // the superseded list now also carries the legacy `--yes`
985
- // spelling, so the entry on disk is not always the one
986
- // `supersededSessionStartCommand` names — reporting that one
987
- // regardless would misdescribe the rewrite whenever the legacy
988
- // entry is what triggered it.
971
+ // Name the exact generated spellings that were replaced.
989
972
  const before = migration.removedCommands
990
973
  .map((command) => `\`${command}\``)
991
974
  .join(', ');
@@ -1581,7 +1564,7 @@ export const initCommand = defineCommand({
1581
1564
  console.log(" --ask-global needs a terminal to answer in — this machine's answer was left as it is");
1582
1565
  }
1583
1566
  if (interactive) {
1584
- const locations = { agents: agentsSkillsRoot(), namespace: namespaceDir() };
1567
+ const locations = { agents: agentsSkillsRoot(), claude: globalSkillsRoot() };
1585
1568
  const recorded = new Map();
1586
1569
  for (const root of LAPTOP_DELIVERY_ROOTS) {
1587
1570
  recorded.set(root, await readGlobalDeliveryConsent(root).catch(() => null));
@@ -1611,7 +1594,7 @@ export const initCommand = defineCommand({
1611
1594
  }
1612
1595
  else if (plan === 'recorded') {
1613
1596
  for (const root of LAPTOP_DELIVERY_ROOTS) {
1614
- const where = root === 'agents-skills' ? locations.agents : locations.namespace;
1597
+ const where = root === 'agents-skills' ? locations.agents : locations.claude;
1615
1598
  const decided = recorded.get(root) ?? null;
1616
1599
  if (decided === true)
1617
1600
  console.log(` ${where}: allowed on this machine`);