@liquidmetal-ai/raindrop 0.4.0 → 0.4.2

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 (71) hide show
  1. package/README.md +184 -51
  2. package/dist/base-command.d.ts +7 -0
  3. package/dist/base-command.d.ts.map +1 -1
  4. package/dist/base-command.js +25 -1
  5. package/dist/codegen.d.ts.map +1 -1
  6. package/dist/codegen.js +9 -0
  7. package/dist/commands/annotation/get.d.ts +22 -0
  8. package/dist/commands/annotation/get.d.ts.map +1 -0
  9. package/dist/commands/annotation/get.js +142 -0
  10. package/dist/commands/annotation/list.d.ts +23 -0
  11. package/dist/commands/annotation/list.d.ts.map +1 -0
  12. package/dist/commands/annotation/list.js +223 -0
  13. package/dist/commands/annotation/put.d.ts +23 -0
  14. package/dist/commands/annotation/put.d.ts.map +1 -0
  15. package/dist/commands/annotation/put.js +172 -0
  16. package/dist/commands/build/branch.d.ts +1 -0
  17. package/dist/commands/build/branch.d.ts.map +1 -1
  18. package/dist/commands/build/checkout.d.ts +1 -0
  19. package/dist/commands/build/checkout.d.ts.map +1 -1
  20. package/dist/commands/build/delete.d.ts +1 -0
  21. package/dist/commands/build/delete.d.ts.map +1 -1
  22. package/dist/commands/build/deploy.d.ts +1 -0
  23. package/dist/commands/build/deploy.d.ts.map +1 -1
  24. package/dist/commands/build/env/get.d.ts +1 -0
  25. package/dist/commands/build/env/get.d.ts.map +1 -1
  26. package/dist/commands/build/env/set.d.ts +1 -0
  27. package/dist/commands/build/env/set.d.ts.map +1 -1
  28. package/dist/commands/build/find.d.ts +1 -0
  29. package/dist/commands/build/find.d.ts.map +1 -1
  30. package/dist/commands/build/list.d.ts +1 -0
  31. package/dist/commands/build/list.d.ts.map +1 -1
  32. package/dist/commands/build/sandbox.d.ts +1 -0
  33. package/dist/commands/build/sandbox.d.ts.map +1 -1
  34. package/dist/commands/build/start.d.ts +1 -0
  35. package/dist/commands/build/start.d.ts.map +1 -1
  36. package/dist/commands/build/status.d.ts +1 -0
  37. package/dist/commands/build/status.d.ts.map +1 -1
  38. package/dist/commands/build/stop.d.ts +1 -0
  39. package/dist/commands/build/stop.d.ts.map +1 -1
  40. package/dist/commands/build/unsandbox.d.ts +1 -0
  41. package/dist/commands/build/unsandbox.d.ts.map +1 -1
  42. package/dist/commands/build/upload.d.ts +1 -0
  43. package/dist/commands/build/upload.d.ts.map +1 -1
  44. package/dist/commands/object/delete.d.ts +1 -0
  45. package/dist/commands/object/delete.d.ts.map +1 -1
  46. package/dist/commands/object/delete.js +5 -2
  47. package/dist/commands/object/get.d.ts +1 -0
  48. package/dist/commands/object/get.d.ts.map +1 -1
  49. package/dist/commands/object/get.js +5 -2
  50. package/dist/commands/object/list.d.ts +1 -0
  51. package/dist/commands/object/list.d.ts.map +1 -1
  52. package/dist/commands/object/list.js +5 -2
  53. package/dist/commands/object/put.d.ts +1 -0
  54. package/dist/commands/object/put.d.ts.map +1 -1
  55. package/dist/commands/object/put.js +5 -2
  56. package/dist/commands/query/chunk-search.d.ts +1 -0
  57. package/dist/commands/query/chunk-search.d.ts.map +1 -1
  58. package/dist/commands/query/chunk-search.js +4 -4
  59. package/dist/commands/query/document.d.ts +26 -0
  60. package/dist/commands/query/document.d.ts.map +1 -0
  61. package/dist/commands/query/document.js +117 -0
  62. package/dist/commands/query/search.d.ts +1 -0
  63. package/dist/commands/query/search.d.ts.map +1 -1
  64. package/dist/commands/query/search.js +3 -3
  65. package/dist/index.d.ts +7 -2
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +10 -4
  68. package/dist/tsconfig.tsbuildinfo +1 -1
  69. package/oclif.manifest.json +1534 -293
  70. package/package.json +2 -2
  71. package/templates/db/package.json +4 -3
@@ -5,7 +5,7 @@ import { Command, Flags } from '@oclif/core';
5
5
  import * as fs from 'node:fs/promises';
6
6
  import path from 'node:path';
7
7
  import { loadConfig, saveConfig } from './config.js';
8
- import { catalogService, objectService, rainbowAuthService, searchAgentService, selectedOrganization, } from './index.js';
8
+ import { catalogService, objectService, rainbowAuthService, searchAgentService, selectedOrganization, annotationService, } from './index.js';
9
9
  export class BaseCommand extends Command {
10
10
  static HIDDEN_FLAGS = {
11
11
  config: Flags.string({
@@ -40,6 +40,11 @@ export class BaseCommand extends Command {
40
40
  description: 'Override the Rainbow user ID derived from the CLI config',
41
41
  hidden: true,
42
42
  }),
43
+ sendVersionMetadata: Flags.string({
44
+ description: 'Send version metadata to the server',
45
+ default: 'true',
46
+ hidden: true,
47
+ }),
43
48
  };
44
49
  static baseFlags = {};
45
50
  static baseArgs = {};
@@ -133,6 +138,7 @@ export class BaseCommand extends Command {
133
138
  identity: await this.catalogIdentity(),
134
139
  overrideAuthToken: this.flags.rainbowAuthToken,
135
140
  logger: this,
141
+ enableSendVersion: this.flags.sendVersionMetadata === 'true',
136
142
  });
137
143
  }
138
144
  async searchAgentService() {
@@ -142,6 +148,7 @@ export class BaseCommand extends Command {
142
148
  configDir: this.config.configDir,
143
149
  identity: await this.catalogIdentity(),
144
150
  logger: this,
151
+ enableSendVersion: this.flags.sendVersionMetadata === 'true',
145
152
  });
146
153
  return result;
147
154
  }
@@ -157,6 +164,23 @@ export class BaseCommand extends Command {
157
164
  baseUrl,
158
165
  },
159
166
  logger: this,
167
+ enableSendVersion: this.flags.sendVersionMetadata === 'true',
168
+ });
169
+ return result;
170
+ }
171
+ async annotationService(appName, versionId) {
172
+ const { client: rainbowAuth } = await this.rainbowAuthService();
173
+ const identity = await this.catalogIdentity();
174
+ const baseUrl = `https://annotation-${appName}-${versionId}.${urlifyOrganizationId(identity.organizationId)}.lmapp.run`;
175
+ const result = await annotationService({
176
+ rainbowAuth,
177
+ configDir: this.config.configDir,
178
+ identity: {
179
+ ...identity,
180
+ baseUrl,
181
+ },
182
+ logger: this,
183
+ enableSendVersion: this.flags.sendVersionMetadata === 'true',
160
184
  });
161
185
  return result;
162
186
  }
@@ -1 +1 @@
1
- {"version":3,"file":"codegen.d.ts","sourceRoot":"","sources":["../src/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OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBlF;AAED,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAE3D"}
package/dist/codegen.js CHANGED
@@ -273,6 +273,10 @@ export function gatherEnvForHandler(handler, app) {
273
273
  bindings[kebabCaseToConstantCase(valueOf(appKvStore.name))] = 'KvStore';
274
274
  types.add('KvStore');
275
275
  }
276
+ for (const appSmartBucket of app.smartBucket) {
277
+ bindings[kebabCaseToConstantCase(valueOf(appSmartBucket.name))] = 'SmartBucket';
278
+ types.add('SmartBucket');
279
+ }
276
280
  for (const env of app.env) {
277
281
  bindings[kebabCaseToConstantCase(valueOf(env.name))] = 'string';
278
282
  }
@@ -285,6 +289,11 @@ export function gatherEnvForHandler(handler, app) {
285
289
  // Add AI binding.
286
290
  bindings['AI'] = 'Ai';
287
291
  types.add('Ai');
292
+ // Add annotation binding if annotation module is available
293
+ // Note: Annotations are provided by the annotation module service
294
+ bindings['annotation'] = `Annotation<Omit<MRNObject, 'type' | 'applicationName' | 'versionId'>>`;
295
+ types.add('Annotation');
296
+ types.add('MRNObject');
288
297
  // Add logger binding.
289
298
  bindings['logger'] = 'Logger';
290
299
  types.add('Logger');
@@ -0,0 +1,22 @@
1
+ import { BaseCommand } from '../../base-command.js';
2
+ export default class AnnotationGet extends BaseCommand<typeof AnnotationGet> {
3
+ static args: {
4
+ mrn: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ format: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ impersonate: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ manifest: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ config: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ rainbowAuthService: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
+ raindropCatalogService: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ rainbowAuthToken: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ rainbowOrganizationId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ rainbowUserId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ sendVersionMetadata: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
19
+ };
20
+ run(): Promise<void>;
21
+ }
22
+ //# sourceMappingURL=get.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/annotation/get.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAMpD,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,WAAW,CAAC,OAAO,aAAa,CAAC;IAC1E,MAAM,CAAC,IAAI;;MAMT;IAEF,MAAM,CAAC,WAAW,SAA8B;IAEhD,MAAM,CAAC,QAAQ,WAUb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;MAqBV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA+G3B"}
@@ -0,0 +1,142 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../base-command.js';
3
+ import { parseMRN } from '@liquidmetal-ai/drizzle/mrn';
4
+ import { create } from '@bufbuild/protobuf';
5
+ import { GetAnnotationRequestSchema, AnnotationLocatorSchema } from '@liquidmetal-ai/protogen2/annotation_pb';
6
+ import { valueOf } from '@liquidmetal-ai/drizzle/appify/build';
7
+ export default class AnnotationGet extends BaseCommand {
8
+ static args = {
9
+ mrn: Args.string({
10
+ description: 'MRN (Machine Resource Name) of the annotation to retrieve. Can be partial (e.g., my-module:my-key:) or full (e.g., annotation:app:v1:my-module:my-key:)',
11
+ required: true,
12
+ }),
13
+ };
14
+ static description = 'Get an annotation by MRN';
15
+ static examples = [
16
+ `<%= config.bin %> annotation get my-module:my-item^my-key:
17
+ Get annotation by partial MRN (prefilled with app/version from manifest and config)
18
+ `,
19
+ `<%= config.bin %> annotation get annotation:my-app:v1.0.0:my-module:my-item^my-key:
20
+ Get annotation with the full MRN
21
+ `,
22
+ `<%= config.bin %> annotation get my-module:my-key: --format json
23
+ Get annotation by partial MRN and output as JSON
24
+ `,
25
+ ];
26
+ static flags = {
27
+ ...BaseCommand.HIDDEN_FLAGS,
28
+ format: Flags.string({
29
+ char: 'f',
30
+ description: 'output format',
31
+ default: 'text',
32
+ options: ['text', 'json'],
33
+ }),
34
+ impersonate: Flags.string({
35
+ char: 'i',
36
+ description: 'impersonate organization',
37
+ required: false,
38
+ hidden: true,
39
+ }),
40
+ manifest: Flags.string({
41
+ char: 'M',
42
+ description: 'project manifest',
43
+ required: false,
44
+ default: 'raindrop.manifest',
45
+ hidden: true,
46
+ }),
47
+ };
48
+ async run() {
49
+ const { args, flags } = await this.parse(AnnotationGet);
50
+ // Determine if we need to prefill MRN with manifest/config data
51
+ let fullMrn = args.mrn;
52
+ let mrnParts;
53
+ if (!args.mrn.startsWith('annotation:') && !args.mrn.startsWith('label:')) {
54
+ // Partial MRN - need to prefill with app name and version from manifest/config
55
+ const apps = await this.loadManifest();
56
+ const config = await this.loadConfig();
57
+ if (apps.length === 0) {
58
+ this.error('No applications found in manifest');
59
+ }
60
+ const app = apps[0];
61
+ const appName = valueOf(app.name);
62
+ const versionId = config.versionId;
63
+ console.log(`Using application: ${appName}, version: ${versionId}`);
64
+ if (!appName) {
65
+ this.error('Application name not found in manifest');
66
+ }
67
+ if (!versionId) {
68
+ this.error('Version ID not found in config. Run a build or deployment first to set the version.');
69
+ }
70
+ fullMrn = `annotation:${appName}:${versionId}:${args.mrn}`;
71
+ }
72
+ // Auto-fill trailing colons if there are fewer than 6 parts in the MRN
73
+ const parts = fullMrn.split(':');
74
+ // A complete annotation MRN has 6 parts (annotation:app:version:module:item:revision)
75
+ if (parts.length < 6) {
76
+ // Add as many colons as needed to get to 6 parts
77
+ const colonsToAdd = 6 - parts.length;
78
+ fullMrn += ':'.repeat(colonsToAdd);
79
+ }
80
+ // Parse MRN to extract components using the common library
81
+ try {
82
+ mrnParts = parseMRN(fullMrn);
83
+ }
84
+ catch (error) {
85
+ this.error(`Invalid MRN format: ${error}`);
86
+ }
87
+ // Get annotation service client
88
+ const { client: annotationServiceClient, userId, organizationId, } = await this.annotationService(mrnParts.applicationName, mrnParts.versionId);
89
+ try {
90
+ // Create annotation locator from MRN parts
91
+ const locator = create(AnnotationLocatorSchema, {
92
+ applicationName: mrnParts.applicationName,
93
+ applicationVersionId: mrnParts.versionId,
94
+ moduleName: mrnParts.module,
95
+ item: mrnParts.item,
96
+ key: mrnParts.key,
97
+ revision: mrnParts.revision,
98
+ });
99
+ // Call the annotation service
100
+ const request = create(GetAnnotationRequestSchema, {
101
+ userId,
102
+ organizationId,
103
+ locator,
104
+ });
105
+ const response = await annotationServiceClient.getAnnotation(request);
106
+ switch (flags.format) {
107
+ case 'json':
108
+ console.log(JSON.stringify({
109
+ mrn: fullMrn,
110
+ inputMrn: args.mrn,
111
+ ...mrnParts,
112
+ annotation: response.annotation?.annotation || '',
113
+ location: response.annotation?.location,
114
+ }, null, 2));
115
+ break;
116
+ case 'text':
117
+ console.log(`MRN: ${fullMrn}`);
118
+ if (fullMrn !== args.mrn) {
119
+ console.log(`Input: ${args.mrn} (prefilled with app/version)`);
120
+ }
121
+ console.log(`Type: ${mrnParts.type}`);
122
+ console.log(`Application: ${mrnParts.applicationName}`);
123
+ console.log(`Version: ${mrnParts.versionId}`);
124
+ if (mrnParts.module)
125
+ console.log(`Module: ${mrnParts.module}`);
126
+ if (mrnParts.item)
127
+ console.log(`Item: ${mrnParts.item}`);
128
+ if (mrnParts.key)
129
+ console.log(`Key: ${mrnParts.key}`);
130
+ if (mrnParts.revision)
131
+ console.log(`Revision: ${mrnParts.revision}`);
132
+ console.log('');
133
+ console.log('Annotation:');
134
+ console.log(response.annotation?.annotation || '(no content)');
135
+ break;
136
+ }
137
+ }
138
+ catch (error) {
139
+ this.error(`Failed to get annotation: ${error}`);
140
+ }
141
+ }
142
+ }
@@ -0,0 +1,23 @@
1
+ import { BaseCommand } from '../../base-command.js';
2
+ export default class AnnotationList extends BaseCommand<typeof AnnotationList> {
3
+ static args: {
4
+ mrnPrefix: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
10
+ limit: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
11
+ impersonate: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ manifest: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ config: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
+ rainbowAuthService: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
15
+ raindropCatalogService: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ rainbowAuthToken: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ rainbowOrganizationId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ rainbowUserId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ sendVersionMetadata: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
20
+ };
21
+ run(): Promise<void>;
22
+ }
23
+ //# sourceMappingURL=list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/annotation/list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAOpD,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,WAAW,CAAC,OAAO,cAAc,CAAC;IAC5E,MAAM,CAAC,IAAI;;MAMT;IAEF,MAAM,CAAC,WAAW,SAAoC;IAEtD,MAAM,CAAC,QAAQ,WAUb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;;MA0BV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA+L3B"}
@@ -0,0 +1,223 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { BaseCommand } from '../../base-command.js';
3
+ import { parseMRN } from '@liquidmetal-ai/drizzle/mrn';
4
+ import { create } from '@bufbuild/protobuf';
5
+ import { ListAnnotationsRequestSchema, AnnotationLocatorSchema } from '@liquidmetal-ai/protogen2/annotation_pb';
6
+ import { valueOf } from '@liquidmetal-ai/drizzle/appify/build';
7
+ export default class AnnotationList extends BaseCommand {
8
+ static args = {
9
+ mrnPrefix: Args.string({
10
+ description: 'MRN prefix to filter annotations (e.g., my-module or annotation:app:v1:my-module). If not provided, uses app/version from manifest and config.',
11
+ required: false,
12
+ }),
13
+ };
14
+ static description = 'List annotations by MRN prefix';
15
+ static examples = [
16
+ `<%= config.bin %> annotation list
17
+ List all annotations for the current app/version from manifest and config
18
+ `,
19
+ `<%= config.bin %> annotation list my-module
20
+ List annotations for 'my-module' (prefilled with app/version from manifest and config)
21
+ `,
22
+ `<%= config.bin %> annotation list annotation:my-app:v1.0.0:my-module --format json
23
+ List annotations for a specific module using full MRN prefix in JSON format
24
+ `,
25
+ ];
26
+ static flags = {
27
+ ...BaseCommand.HIDDEN_FLAGS,
28
+ output: Flags.string({
29
+ char: 'o',
30
+ description: 'output format',
31
+ default: 'table',
32
+ options: ['table', 'text', 'json'],
33
+ }),
34
+ limit: Flags.integer({
35
+ char: 'l',
36
+ description: 'maximum number of annotations to return',
37
+ default: 100,
38
+ }),
39
+ impersonate: Flags.string({
40
+ char: 'i',
41
+ description: 'impersonate organization',
42
+ required: false,
43
+ hidden: true,
44
+ }),
45
+ manifest: Flags.string({
46
+ char: 'M',
47
+ description: 'project manifest',
48
+ required: false,
49
+ default: 'raindrop.manifest',
50
+ hidden: true,
51
+ }),
52
+ };
53
+ async run() {
54
+ const { args, flags } = await this.parse(AnnotationList);
55
+ // Parse MRN prefix if provided to extract application info for service connection
56
+ let appName = '';
57
+ let versionId = '';
58
+ let mrnParts = {};
59
+ let fullMrnPrefix = args.mrnPrefix || '';
60
+ if (args.mrnPrefix) {
61
+ // Check if we need to prefill with manifest/config data
62
+ if (!args.mrnPrefix.startsWith('annotation:') && !args.mrnPrefix.startsWith('label:')) {
63
+ // Partial MRN - need to prefill with app name and version from manifest/config
64
+ const apps = await this.loadManifest();
65
+ const config = await this.loadConfig();
66
+ if (apps.length === 0) {
67
+ this.error('No applications found in manifest');
68
+ }
69
+ const app = apps[0];
70
+ const manifestAppName = valueOf(app.name);
71
+ const configVersionId = config.versionId;
72
+ if (!manifestAppName) {
73
+ this.error('Application name not found in manifest');
74
+ }
75
+ if (!configVersionId) {
76
+ this.error('Version ID not found in config. Run a build or deployment first to set the version.');
77
+ }
78
+ fullMrnPrefix = `annotation:${manifestAppName}:${configVersionId}:${args.mrnPrefix}`;
79
+ }
80
+ try {
81
+ // Try to parse as full MRN first
82
+ mrnParts = parseMRN(fullMrnPrefix);
83
+ appName = mrnParts.applicationName;
84
+ versionId = mrnParts.versionId;
85
+ }
86
+ catch {
87
+ // If it fails, try to extract at least app:version from prefix
88
+ const parts = fullMrnPrefix.split(':');
89
+ if (parts.length >= 3 && parts[0] === 'annotation') {
90
+ appName = parts[1];
91
+ versionId = parts[2];
92
+ mrnParts = {
93
+ type: parts[0],
94
+ applicationName: parts[1],
95
+ versionId: parts[2],
96
+ module: parts[3] || undefined,
97
+ key: parts[4] || undefined,
98
+ revision: parts[5] || undefined,
99
+ };
100
+ }
101
+ else {
102
+ this.error('MRN prefix must at least contain annotation:applicationName:versionId');
103
+ }
104
+ }
105
+ }
106
+ else {
107
+ // No MRN prefix provided - use manifest/config data to create default prefix
108
+ const apps = await this.loadManifest();
109
+ const config = await this.loadConfig();
110
+ if (apps.length === 0) {
111
+ this.error('No applications found in manifest');
112
+ }
113
+ const app = apps[0];
114
+ const manifestAppName = valueOf(app.name);
115
+ const configVersionId = config.versionId;
116
+ if (!manifestAppName) {
117
+ this.error('Application name not found in manifest');
118
+ }
119
+ if (!configVersionId) {
120
+ this.error('Version ID not found in config. Run a build or deployment first to set the version.');
121
+ }
122
+ appName = manifestAppName;
123
+ versionId = configVersionId;
124
+ fullMrnPrefix = `annotation:${manifestAppName}:${configVersionId}`;
125
+ mrnParts = {
126
+ type: 'annotation',
127
+ applicationName: manifestAppName,
128
+ versionId: configVersionId,
129
+ };
130
+ }
131
+ // Get annotation service client
132
+ const { client: annotationServiceClient, userId, organizationId, } = await this.annotationService(appName, versionId);
133
+ try {
134
+ // Create annotation locator from MRN parts
135
+ const locator = create(AnnotationLocatorSchema, {
136
+ applicationName: mrnParts.applicationName,
137
+ applicationVersionId: mrnParts.versionId,
138
+ moduleName: mrnParts.module,
139
+ item: mrnParts.item,
140
+ key: mrnParts.key,
141
+ revision: mrnParts.revision,
142
+ });
143
+ // Call the annotation service
144
+ const request = create(ListAnnotationsRequestSchema, {
145
+ userId,
146
+ organizationId,
147
+ locator,
148
+ });
149
+ const response = await annotationServiceClient.listAnnotations(request);
150
+ const annotations = response.annotation || [];
151
+ switch (flags.output) {
152
+ case 'json':
153
+ console.log(JSON.stringify({
154
+ annotations: annotations.map((loc) => ({
155
+ applicationName: loc.applicationName,
156
+ applicationVersionId: loc.applicationVersionId,
157
+ moduleName: loc.moduleName,
158
+ item: loc.item,
159
+ key: loc.key,
160
+ revision: loc.revision,
161
+ })),
162
+ total: annotations.length,
163
+ prefix: fullMrnPrefix,
164
+ inputPrefix: args.mrnPrefix,
165
+ }, null, 2));
166
+ break;
167
+ case 'text':
168
+ console.log(`Found ${annotations.length} annotations`);
169
+ console.log(`Prefix: ${fullMrnPrefix}`);
170
+ if (fullMrnPrefix !== (args.mrnPrefix || '')) {
171
+ console.log(`Input: ${args.mrnPrefix || '(none)'} (prefilled with app/version)`);
172
+ }
173
+ console.log('');
174
+ annotations.forEach((loc, index) => {
175
+ const mrn = `${loc.applicationName}:${loc.applicationVersionId}:${loc.moduleName || ''}:${loc.item || ''}^${loc.key || ''}:${loc.revision || ''}`;
176
+ console.log(`${index + 1}. ${mrn}`);
177
+ console.log(` Application: ${loc.applicationName}`);
178
+ console.log(` Version: ${loc.applicationVersionId}`);
179
+ if (loc.moduleName)
180
+ console.log(` Module: ${loc.moduleName}`);
181
+ if (loc.item)
182
+ console.log(` Item: ${loc.item}`);
183
+ if (loc.key)
184
+ console.log(` Key: ${loc.key}`);
185
+ if (loc.revision)
186
+ console.log(` Revision: ${loc.revision}`);
187
+ console.log('');
188
+ });
189
+ break;
190
+ case 'table':
191
+ if (annotations.length === 0) {
192
+ console.log('No annotations found');
193
+ console.log(`Prefix: ${fullMrnPrefix}`);
194
+ if (fullMrnPrefix !== (args.mrnPrefix || '')) {
195
+ console.log(`Input: ${args.mrnPrefix || '(none)'} (prefilled with app/version)`);
196
+ }
197
+ }
198
+ else {
199
+ console.log('Application Version Module Item Key Revision');
200
+ console.log('--------------- --------------- --------------- --------------- --------------- ---------------');
201
+ annotations.forEach((loc) => {
202
+ const app = (loc.applicationName || '').padEnd(15).substring(0, 15);
203
+ const version = (loc.applicationVersionId || '').padEnd(15).substring(0, 15);
204
+ const module = (loc.moduleName || '').padEnd(15).substring(0, 15);
205
+ const item = (loc.item || '').padEnd(15).substring(0, 15);
206
+ const key = (loc.key || '').padEnd(15).substring(0, 15);
207
+ const revision = (loc.revision || '').padEnd(15).substring(0, 15);
208
+ console.log(`${app} ${version} ${module} ${item} ${key} ${revision}`);
209
+ });
210
+ console.log(`\nTotal: ${annotations.length} annotations`);
211
+ console.log(`Prefix: ${fullMrnPrefix}`);
212
+ if (fullMrnPrefix !== (args.mrnPrefix || '')) {
213
+ console.log(`Input: ${args.mrnPrefix || '(none)'} (prefilled with app/version)`);
214
+ }
215
+ }
216
+ break;
217
+ }
218
+ }
219
+ catch (error) {
220
+ this.error(`Failed to list annotations: ${error}`);
221
+ }
222
+ }
223
+ }
@@ -0,0 +1,23 @@
1
+ import { BaseCommand } from '../../base-command.js';
2
+ export default class AnnotationPut extends BaseCommand<typeof AnnotationPut> {
3
+ static args: {
4
+ mrn: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
+ annotation: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static description: string;
8
+ static examples: string[];
9
+ static flags: {
10
+ output: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
+ impersonate: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ manifest: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ config: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
+ rainbowAuthService: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
15
+ raindropCatalogService: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ rainbowAuthToken: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ rainbowOrganizationId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ rainbowUserId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ sendVersionMetadata: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
20
+ };
21
+ run(): Promise<void>;
22
+ }
23
+ //# sourceMappingURL=put.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"put.d.ts","sourceRoot":"","sources":["../../../src/commands/annotation/put.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAOpD,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,WAAW,CAAC,OAAO,aAAa,CAAC;IAC1E,MAAM,CAAC,IAAI;;;MAUT;IAEF,MAAM,CAAC,WAAW,SAA2C;IAE7D,MAAM,CAAC,QAAQ,WAUb;IAEF,MAAM,CAAC,KAAK;;;;;;;;;;;MAqBV;IAEI,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAyI3B"}