@copado/agentia-cli 0.8.0-alpha.0 → 0.10.0-alpha.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 (62) hide show
  1. package/README.md +362 -30
  2. package/dist/commands/auth/set.js +8 -2
  3. package/dist/commands/auth/set.js.map +1 -1
  4. package/dist/commands/promotion/conflict/get.d.ts +19 -0
  5. package/dist/commands/promotion/conflict/get.js +54 -0
  6. package/dist/commands/promotion/conflict/get.js.map +1 -0
  7. package/dist/commands/promotion/conflict/list.d.ts +10 -0
  8. package/dist/commands/promotion/conflict/list.js +35 -0
  9. package/dist/commands/promotion/conflict/list.js.map +1 -0
  10. package/dist/commands/promotion/conflict/resolve.d.ts +15 -0
  11. package/dist/commands/promotion/conflict/resolve.js +59 -0
  12. package/dist/commands/promotion/conflict/resolve.js.map +1 -0
  13. package/dist/commands/promotion/conflict/unresolve.d.ts +13 -0
  14. package/dist/commands/promotion/conflict/unresolve.js +37 -0
  15. package/dist/commands/promotion/conflict/unresolve.js.map +1 -0
  16. package/dist/commands/work/create.d.ts +35 -0
  17. package/dist/commands/work/create.js +47 -0
  18. package/dist/commands/work/create.js.map +1 -0
  19. package/dist/commands/work/delete.d.ts +11 -0
  20. package/dist/commands/work/delete.js +29 -0
  21. package/dist/commands/work/delete.js.map +1 -0
  22. package/dist/commands/work/get.d.ts +10 -0
  23. package/dist/commands/work/get.js +29 -0
  24. package/dist/commands/work/get.js.map +1 -0
  25. package/dist/commands/work/list.d.ts +20 -0
  26. package/dist/commands/work/list.js +58 -0
  27. package/dist/commands/work/list.js.map +1 -0
  28. package/dist/commands/work/update.d.ts +38 -0
  29. package/dist/commands/work/update.js +52 -0
  30. package/dist/commands/work/update.js.map +1 -0
  31. package/dist/lib/cicd-gateway.d.ts +11 -0
  32. package/dist/lib/cicd-gateway.js +56 -6
  33. package/dist/lib/cicd-gateway.js.map +1 -1
  34. package/dist/lib/defaults-store.d.ts +5 -0
  35. package/dist/lib/defaults-store.js +61 -0
  36. package/dist/lib/defaults-store.js.map +1 -1
  37. package/dist/lib/environment-auth-status.js +2 -5
  38. package/dist/lib/environment-auth-status.js.map +1 -1
  39. package/dist/lib/environment-auth.js +2 -5
  40. package/dist/lib/environment-auth.js.map +1 -1
  41. package/dist/lib/mcp/tools.d.ts +37 -0
  42. package/dist/lib/mcp/tools.js +211 -0
  43. package/dist/lib/mcp/tools.js.map +1 -1
  44. package/dist/lib/promotion-conflicts.d.ts +40 -0
  45. package/dist/lib/promotion-conflicts.js +83 -0
  46. package/dist/lib/promotion-conflicts.js.map +1 -0
  47. package/dist/lib/user-context-types.d.ts +6 -0
  48. package/dist/lib/user-context-types.js.map +1 -1
  49. package/dist/lib/user-context.d.ts +7 -0
  50. package/dist/lib/user-context.js +35 -0
  51. package/dist/lib/user-context.js.map +1 -0
  52. package/dist/lib/work-defaults.d.ts +10 -0
  53. package/dist/lib/work-defaults.js +48 -0
  54. package/dist/lib/work-defaults.js.map +1 -0
  55. package/dist/lib/work-flags.d.ts +122 -0
  56. package/dist/lib/work-flags.js +231 -0
  57. package/dist/lib/work-flags.js.map +1 -0
  58. package/dist/lib/work-types.d.ts +115 -0
  59. package/dist/lib/work-types.js +87 -0
  60. package/dist/lib/work-types.js.map +1 -0
  61. package/oclif.manifest.json +960 -119
  62. package/package.json +7 -1
@@ -0,0 +1,54 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { writeFileSync } from 'node:fs';
3
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
4
+ import { CicdGateway } from '../../../lib/cicd-gateway.js';
5
+ import { promotionConflictContentEndpoint, withPromotionConflictErrorTranslation, } from '../../../lib/promotion-conflicts.js';
6
+ export default class PromotionConflictGet extends AgentiaCommand {
7
+ static args = {
8
+ id: Args.string({
9
+ description: 'Conflict attachment Id',
10
+ required: true,
11
+ }),
12
+ };
13
+ static description = 'Get raw merge-conflict content for a promotion file';
14
+ static examples = [
15
+ '<%= config.bin %> <%= command.id %> <conflict-id> --promotion <promotion-id>',
16
+ '<%= config.bin %> <%= command.id %> <conflict-id> -p <promotion-id> --output ./MyClass.cls',
17
+ '<%= config.bin %> <%= command.id %> <conflict-id> -p <promotion-id> --json',
18
+ ];
19
+ static flags = {
20
+ output: Flags.string({
21
+ description: 'Write raw conflict content to this file path',
22
+ }),
23
+ promotion: Flags.string({
24
+ char: 'p',
25
+ description: 'Copado promotion Id',
26
+ required: true,
27
+ }),
28
+ };
29
+ async run() {
30
+ const { args, flags } = await this.parse(PromotionConflictGet);
31
+ const content = await this.withSpinner('Fetching promotion conflict content', () => withPromotionConflictErrorTranslation(() => CicdGateway.call({
32
+ endpoint: promotionConflictContentEndpoint(flags.promotion, args.id),
33
+ method: 'GET',
34
+ responseType: 'text',
35
+ })));
36
+ if (flags.output !== undefined) {
37
+ writeFileSync(flags.output, content, 'utf8');
38
+ }
39
+ this.display(() => {
40
+ if (flags.output !== undefined) {
41
+ this.log(`Wrote promotion conflict content to ${flags.output}.`);
42
+ return;
43
+ }
44
+ process.stdout.write(content);
45
+ });
46
+ return {
47
+ conflictId: args.id,
48
+ content,
49
+ ...(flags.output === undefined ? {} : { output: flags.output }),
50
+ promotionId: flags.promotion,
51
+ };
52
+ }
53
+ }
54
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../src/commands/promotion/conflict/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AACvC,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAA;AAErC,OAAO,EAAC,cAAc,EAAC,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AACxD,OAAO,EACL,gCAAgC,EAChC,qCAAqC,GACtC,MAAM,qCAAqC,CAAA;AAS5C,MAAM,CAAC,OAAO,OAAO,oBAAqB,SAAQ,cAAc;IAC9D,MAA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GAAG,CAAC,CAAA;gBAChE,OAAM;YACR,CAAC;YAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAC/B,CAAC,CAAC,CAAA;QAEF,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,EAAE;YACnB,OAAO;YACP,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAC,CAAC;YAC7D,WAAW,EAAE,KAAK,CAAC,SAAS;SAC7B,CAAA;IACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
2
+ import { type PromotionConflict } from '../../../lib/promotion-conflicts.js';
3
+ export default class PromotionConflictList extends AgentiaCommand {
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: {
7
+ promotion: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
8
+ };
9
+ run(): Promise<PromotionConflict[]>;
10
+ }
@@ -0,0 +1,35 @@
1
+ import { Flags } from '@oclif/core';
2
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
3
+ import { CicdGateway } from '../../../lib/cicd-gateway.js';
4
+ import { formatPromotionConflictTable, normalizePromotionConflicts, promotionConflictsEndpoint, withPromotionConflictErrorTranslation, } from '../../../lib/promotion-conflicts.js';
5
+ export default class PromotionConflictList extends AgentiaCommand {
6
+ static description = 'List merge conflicts for a Copado promotion';
7
+ static examples = [
8
+ '<%= config.bin %> <%= command.id %> --promotion <promotion-id>',
9
+ '<%= config.bin %> <%= command.id %> -p <promotion-id> --json',
10
+ ];
11
+ static flags = {
12
+ promotion: Flags.string({
13
+ char: 'p',
14
+ description: 'Copado promotion Id',
15
+ required: true,
16
+ }),
17
+ };
18
+ async run() {
19
+ const { flags } = await this.parse(PromotionConflictList);
20
+ const response = await this.withSpinner('Fetching promotion conflicts', () => withPromotionConflictErrorTranslation(() => CicdGateway.call({
21
+ endpoint: promotionConflictsEndpoint(flags.promotion),
22
+ method: 'GET',
23
+ })));
24
+ const conflicts = normalizePromotionConflicts(response);
25
+ this.display(() => {
26
+ if (conflicts.length === 0) {
27
+ this.log('No promotion conflicts were found.');
28
+ return;
29
+ }
30
+ this.log(formatPromotionConflictTable(conflicts));
31
+ });
32
+ return conflicts;
33
+ }
34
+ }
35
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/promotion/conflict/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AAEjC,OAAO,EAAC,cAAc,EAAC,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AACxD,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,EAG3B,0BAA0B,EAC1B,qCAAqC,GACtC,MAAM,qCAAqC,CAAA;AAE5C,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,cAAc;IAC/D,MAAM,CAAU,WAAW,GAAG,6CAA6C,CAAA;IAC3E,MAAM,CAAU,QAAQ,GAAG;QACzB,gEAAgE;QAChE,8DAA8D;KAC/D,CAAA;IACD,MAAM,CAAU,KAAK,GAAG;QACtB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC;YACtB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,qBAAqB;YAClC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAA;IAEM,KAAK,CAAC,GAAG;QACd,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAA;QACvD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,8BAA8B,EAAE,GAAG,EAAE,CAC3E,qCAAqC,CAAC,GAAG,EAAE,CACzC,WAAW,CAAC,IAAI,CAAsD;YACpE,QAAQ,EAAE,0BAA0B,CAAC,KAAK,CAAC,SAAS,CAAC;YACrD,MAAM,EAAE,KAAK;SACd,CAAC,CACH,CACF,CAAA;QACD,MAAM,SAAS,GAAG,2BAA2B,CAAC,QAAQ,CAAC,CAAA;QAEvD,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;YAChB,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC3B,IAAI,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;gBAC9C,OAAM;YACR,CAAC;YAED,IAAI,CAAC,GAAG,CAAC,4BAA4B,CAAC,SAAS,CAAC,CAAC,CAAA;QACnD,CAAC,CAAC,CAAA;QAEF,OAAO,SAAS,CAAA;IAClB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
2
+ import { type PromotionConflictResolutionResult } from '../../../lib/promotion-conflicts.js';
3
+ export default class PromotionConflictResolve extends AgentiaCommand {
4
+ static args: {
5
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static description: string;
8
+ static examples: string[];
9
+ static flags: {
10
+ file: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ mode: import("@oclif/core/interfaces").OptionFlag<"auto" | "manual", import("@oclif/core/interfaces").CustomOptions>;
12
+ promotion: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
13
+ };
14
+ run(): Promise<PromotionConflictResolutionResult>;
15
+ }
@@ -0,0 +1,59 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { readFileSync } from 'node:fs';
3
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
4
+ import { CicdGateway } from '../../../lib/cicd-gateway.js';
5
+ import { buildPromotionConflictResolutionRequest, PROMOTION_CONFLICT_MODES, promotionConflictResolveEndpoint, withPromotionConflictErrorTranslation, } from '../../../lib/promotion-conflicts.js';
6
+ export default class PromotionConflictResolve extends AgentiaCommand {
7
+ static args = {
8
+ id: Args.string({
9
+ description: 'Conflict attachment Id',
10
+ required: true,
11
+ }),
12
+ };
13
+ static description = 'Resolve a promotion merge conflict automatically or from a file';
14
+ static examples = [
15
+ '<%= config.bin %> <%= command.id %> <conflict-id> --promotion <promotion-id> --mode auto',
16
+ '<%= config.bin %> <%= command.id %> <conflict-id> -p <promotion-id> --mode manual --file ./MyClass.cls',
17
+ '<%= config.bin %> <%= command.id %> <conflict-id> -p <promotion-id> --mode auto --json',
18
+ ];
19
+ static flags = {
20
+ file: Flags.string({
21
+ description: 'Path to manually resolved conflict content',
22
+ }),
23
+ mode: Flags.option({
24
+ description: 'Conflict resolution mode',
25
+ options: [...PROMOTION_CONFLICT_MODES],
26
+ required: true,
27
+ })(),
28
+ promotion: Flags.string({
29
+ char: 'p',
30
+ description: 'Copado promotion Id',
31
+ required: true,
32
+ }),
33
+ };
34
+ async run() {
35
+ const { args, flags } = await this.parse(PromotionConflictResolve);
36
+ const resolveFlags = flags;
37
+ if (resolveFlags.mode === 'manual' && resolveFlags.file === undefined) {
38
+ this.error('--file is required when --mode manual is used.', { exit: 2 });
39
+ }
40
+ if (resolveFlags.mode === 'auto' && resolveFlags.file !== undefined) {
41
+ this.error('--file can only be used when --mode manual is used.', { exit: 2 });
42
+ }
43
+ const content = resolveFlags.file === undefined ? undefined : readFileSync(resolveFlags.file, 'utf8');
44
+ const body = buildPromotionConflictResolutionRequest(resolveFlags.mode, content);
45
+ const result = await this.withSpinner('Resolving promotion conflict', () => withPromotionConflictErrorTranslation(() => CicdGateway.call({
46
+ body,
47
+ endpoint: promotionConflictResolveEndpoint(resolveFlags.promotion, args.id),
48
+ headers: { 'Content-Type': 'application/json' },
49
+ method: 'POST',
50
+ })));
51
+ this.display(() => {
52
+ this.log(`Success: Conflict ${args.id} resolved successfully.`);
53
+ this.log(`Resolved count: ${result.resolvedCount ?? 0}`);
54
+ this.log(`Promotion status updated: ${result.promotionStatusUpdated ?? false}`);
55
+ });
56
+ return result;
57
+ }
58
+ }
59
+ //# sourceMappingURL=resolve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../../src/commands/promotion/conflict/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAA;AAEpC,OAAO,EAAC,cAAc,EAAC,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AACxD,OAAO,EACL,uCAAuC,EACvC,wBAAwB,EAGxB,gCAAgC,EAChC,qCAAqC,GACtC,MAAM,qCAAqC,CAAA;AAQ5C,MAAM,CAAC,OAAO,OAAO,wBAAyB,SAAQ,cAAc;IAClE,MAAM,CAAU,IAAI,GAAG;QACrB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,WAAW,EAAE,wBAAwB;YACrC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAA;IACD,MAAM,CAAU,WAAW,GAAG,iEAAiE,CAAA;IAC/F,MAAM,CAAU,QAAQ,GAAG;QACzB,0FAA0F;QAC1F,wGAAwG;QACxG,wFAAwF;KACzF,CAAA;IACD,MAAM,CAAU,KAAK,GAAG;QACtB,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE,4CAA4C;SAC1D,CAAC;QACF,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE,0BAA0B;YACvC,OAAO,EAAE,CAAC,GAAG,wBAAwB,CAAC;YACtC,QAAQ,EAAE,IAAI;SACf,CAAC,EAAE;QACJ,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC;YACtB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,qBAAqB;YAClC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAA;IAEM,KAAK,CAAC,GAAG;QACd,MA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AmB,MAAM,CAAC,aAAa,IAAI,CAAC,EAAE,CAAC,CAAA;YACxD,IAAI,CAAC,GAAG,CAAC,6BAA6B,MAAM,CAAC,sBAAsB,IAAI,KAAK,EAAE,CAAC,CAAA;QACjF,CAAC,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
2
+ import { type PromotionConflictUndoResult } from '../../../lib/promotion-conflicts.js';
3
+ export default class PromotionConflictUnresolve extends AgentiaCommand {
4
+ static args: {
5
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static description: string;
8
+ static examples: string[];
9
+ static flags: {
10
+ promotion: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
+ };
12
+ run(): Promise<PromotionConflictUndoResult>;
13
+ }
@@ -0,0 +1,37 @@
1
+ import { Args, Flags } from '@oclif/core';
2
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
3
+ import { CicdGateway } from '../../../lib/cicd-gateway.js';
4
+ import { promotionConflictUndoEndpoint, withPromotionConflictErrorTranslation, } from '../../../lib/promotion-conflicts.js';
5
+ export default class PromotionConflictUnresolve extends AgentiaCommand {
6
+ static args = {
7
+ id: Args.string({
8
+ description: 'Conflict attachment Id',
9
+ required: true,
10
+ }),
11
+ };
12
+ static description = 'Undo a promotion conflict resolution';
13
+ static examples = [
14
+ '<%= config.bin %> <%= command.id %> <conflict-id> --promotion <promotion-id>',
15
+ '<%= config.bin %> <%= command.id %> <conflict-id> -p <promotion-id> --json',
16
+ ];
17
+ static flags = {
18
+ promotion: Flags.string({
19
+ char: 'p',
20
+ description: 'Copado promotion Id',
21
+ required: true,
22
+ }),
23
+ };
24
+ async run() {
25
+ const { args, flags } = await this.parse(PromotionConflictUnresolve);
26
+ const result = await this.withSpinner('Undoing promotion conflict resolution', () => withPromotionConflictErrorTranslation(() => CicdGateway.call({
27
+ endpoint: promotionConflictUndoEndpoint(flags.promotion, args.id),
28
+ method: 'POST',
29
+ })));
30
+ this.display(() => {
31
+ this.log(`Success: Resolution undone for conflict ${args.id}.`);
32
+ this.log(`Undone count: ${result.undoneCount ?? 0}`);
33
+ });
34
+ return result;
35
+ }
36
+ }
37
+ //# sourceMappingURL=unresolve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unresolve.js","sourceRoot":"","sources":["../../../../src/commands/promotion/conflict/unresolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAEvC,OAAO,EAAC,cAAc,EAAC,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AACxD,OAAO,EACL,6BAA6B,EAE7B,qCAAqC,GACtC,MAAM,qCAAqC,CAAA;AAE5C,MAAM,CAAC,OAAO,OAAO,0BAA2B,SAAQ,cAAc;IACpE,MAAM,CAAU,IAAI,GAAG;QACrB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,WAAW,EAAE,wBAAwB;YACrC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAA;IACD,MAAM,CAAU,WAAW,GAAG,sCAAsC,CAAA;IACpE,MAAM,CAAU,QAAQ,GAAG;QACzB,8EAA8E;QAC9E,4EAA4E;KAC7E,CAAA;IACD,MAAM,CAAU,KAAK,GAAG;QACtB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC;YACtB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,qBAAqB;YAClC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAA;IAEM,KAAK,CAAC,GAAG;QACd,MAAM,EAAC,IAAI,EAAE,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAClE,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,uCAAuC,EAAE,GAAG,EAAE,CAClF,qCAAqC,CAAC,GAAG,EAAE,CACzC,WAAW,CAAC,IAAI,CAA8B;YAC5C,QAAQ,EAAE,6BAA6B,CAAC,KAAK,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,CAAC;YACjE,MAAM,EAAE,MAAM;SACf,CAAC,CACH,CACF,CAAA;QAED,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;YAChB,IAAI,CAAC,GAAG,CAAC,2CAA2C,IAAI,CAAC,EAAE,GAAG,CAAC,CAAA;YAC/D,IAAI,CAAC,GAAG,CAAC,iBAAiB,MAAM,CAAC,WAAW,IAAI,CAAC,EAAE,CAAC,CAAA;QACtD,CAAC,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
2
+ import { type UserStory } from '../../lib/work-types.js';
3
+ export default class WorkCreate extends AgentiaCommand {
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: {
7
+ readonly 'acceptance-criteria': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
8
+ readonly 'as-a': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ readonly assignee: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ readonly 'cancellation-reason': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ readonly 'close-date': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ readonly epic: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ readonly feature: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ readonly 'functional-requirements': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ readonly 'owner-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ readonly project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ readonly 'record-type': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ readonly 'release-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ readonly 'so-that': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ readonly 'source-credential': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
+ readonly 'source-environment': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
22
+ readonly 'sprint-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
+ readonly status: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
24
+ readonly team: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
25
+ readonly 'technical-specifications': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
26
+ readonly theme: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
27
+ readonly title: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
28
+ readonly 'want-to': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
29
+ readonly 'actual-points': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
30
+ readonly 'planned-points': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
31
+ readonly priority: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
32
+ readonly 'excluded-from-cbm': import("@oclif/core/interfaces").BooleanFlag<boolean>;
33
+ };
34
+ run(): Promise<UserStory>;
35
+ }
@@ -0,0 +1,47 @@
1
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
2
+ import { CicdGateway } from '../../lib/cicd-gateway.js';
3
+ import { readDefaults, resolveDefaults } from '../../lib/defaults-store.js';
4
+ import { PROJECT_DEFAULT_KEYS } from '../../lib/project-defaults.js';
5
+ import { buildWorkCreatePayload } from '../../lib/work-defaults.js';
6
+ import { buildWorkMutationPayload, validateNonEmptyStringFields, WORK_STRING_VALIDATION_KEYS, workMutationFlags, } from '../../lib/work-flags.js';
7
+ import { workCreateEndpoint } from '../../lib/work-types.js';
8
+ export default class WorkCreate extends AgentiaCommand {
9
+ static description = 'Create a Copado user story';
10
+ static examples = [
11
+ '<%= config.bin %> <%= command.id %> --title "My story" --status Draft',
12
+ '<%= config.bin %> <%= command.id %> --title "My story" --json',
13
+ ];
14
+ static flags = workMutationFlags;
15
+ async run() {
16
+ const { flags } = await this.parse(WorkCreate);
17
+ const explicitPayload = buildWorkMutationPayload(flags);
18
+ const [localDefaults, globalDefaults] = await Promise.all([readDefaults('local'), readDefaults('global')]);
19
+ const resolvedDefaults = resolveDefaults(localDefaults, globalDefaults, [...PROJECT_DEFAULT_KEYS]);
20
+ let payload;
21
+ try {
22
+ payload = await buildWorkCreatePayload(explicitPayload, resolvedDefaults);
23
+ }
24
+ catch (error) {
25
+ this.error(error.message, { exit: 1 });
26
+ }
27
+ const validationError = validateNonEmptyStringFields(payload, WORK_STRING_VALIDATION_KEYS);
28
+ if (validationError !== undefined) {
29
+ this.error(validationError, { exit: 2 });
30
+ }
31
+ const userStory = await this.withSpinner('Creating user story', () => CicdGateway.call({
32
+ body: payload,
33
+ endpoint: workCreateEndpoint(),
34
+ headers: {
35
+ 'Content-Type': 'application/json',
36
+ },
37
+ method: 'POST',
38
+ }));
39
+ this.display(() => {
40
+ const name = userStory.name ?? userStory.title ?? 'unknown name';
41
+ const id = userStory.id ?? 'unknown id';
42
+ this.log(`Created user story ${name} (ID: ${id}).`);
43
+ });
44
+ return userStory;
45
+ }
46
+ }
47
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../src/commands/work/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAC,YAAY,EAAE,eAAe,EAAC,MAAM,6BAA6B,CAAA;AACzE,OAAO,EAAC,oBAAoB,EAAC,MAAM,+BAA+B,CAAA;AAClE,OAAO,EAAC,sBAAsB,EAAC,MAAM,4BAA4B,CAAA;AACjE,OAAO,EACL,wBAAwB,EACxB,4BAA4B,EAC5B,2BAA2B,EAC3B,iBAAiB,GAClB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAgD,kBAAkB,EAAC,MAAM,yBAAyB,CAAA;AAEzG,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,cAAc;IACpD,MAAM,CAAU,WAAW,GAAG,4BAA4B,CAAA;IAC1D,MAAM,CAAU,QAAQ,GAAG;QACzB,uEAAuE;QACvE,+DAA+D;KAChE,CAAA;IACD,MAAM,CAAU,KAAK,GAAG,iBAAiB,CAAA;IAElC,KAAK,CAAC,GAAG;QACd,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;QAC5C,MAAM,eAAe,GAAG,wBAAwB,CAAC,KAAK,CAAC,CAAA;QACvD,MAAM,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;QAC1G,MAAM,gBAAgB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static args: {
4
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ run(): Promise<{
9
+ id: string;
10
+ }>;
11
+ }
@@ -0,0 +1,29 @@
1
+ import { Args } from '@oclif/core';
2
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
3
+ import { CicdGateway } from '../../lib/cicd-gateway.js';
4
+ import { workEndpoint } from '../../lib/work-types.js';
5
+ export default class WorkDelete extends AgentiaCommand {
6
+ static args = {
7
+ id: Args.string({
8
+ description: 'User story ID',
9
+ required: true,
10
+ }),
11
+ };
12
+ static description = 'Delete a Copado user story by ID';
13
+ static examples = [
14
+ '<%= config.bin %> <%= command.id %> a0SKC000000CmZ2AU',
15
+ '<%= config.bin %> <%= command.id %> a0SKC000000CmZ2AU --json',
16
+ ];
17
+ async run() {
18
+ const { args } = await this.parse(WorkDelete);
19
+ await this.withSpinner('Deleting user story', () => CicdGateway.call({
20
+ endpoint: workEndpoint(args.id),
21
+ method: 'DELETE',
22
+ }));
23
+ this.display(() => {
24
+ this.log(`Deleted user story (ID: ${args.id}).`);
25
+ });
26
+ return { id: args.id };
27
+ }
28
+ }
29
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../src/commands/work/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAA;AAEhC,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAA;AAEpD,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,cAAc;IACpD,MAAM,CAAU,IAAI,GAAG;QACrB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,WAAW,EAAE,eAAe;YAC5B,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAA;IACD,MAAM,CAAU,WAAW,GAAG,kCAAkC,CAAA;IAChE,MAAM,CAAU,QAAQ,GAAG;QACzB,uDAAuD;QACvD,8DAA8D;KAC/D,CAAA;IAEM,KAAK,CAAC,GAAG;QACd,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;QAE3C,MAAM,IAAI,CAAC,WAAW,CAAC,qBAAqB,EAAE,GAAG,EAAE,CACjD,WAAW,CAAC,IAAI,CAAO;YACrB,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/B,MAAM,EAAE,QAAQ;SACjB,CAAC,CACH,CAAA;QAED,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;YAChB,IAAI,CAAC,GAAG,CAAC,2BAA2B,IAAI,CAAC,EAAE,IAAI,CAAC,CAAA;QAClD,CAAC,CAAC,CAAA;QAEF,OAAO,EAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAC,CAAA;IACtB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
2
+ import { type UserStory } from '../../lib/work-types.js';
3
+ export default class WorkGet extends AgentiaCommand {
4
+ static args: {
5
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static description: string;
8
+ static examples: string[];
9
+ run(): Promise<UserStory>;
10
+ }
@@ -0,0 +1,29 @@
1
+ import { Args } from '@oclif/core';
2
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
3
+ import { CicdGateway } from '../../lib/cicd-gateway.js';
4
+ import { formatUserStoryDetail, workEndpoint } from '../../lib/work-types.js';
5
+ export default class WorkGet extends AgentiaCommand {
6
+ static args = {
7
+ id: Args.string({
8
+ description: 'User story ID',
9
+ required: true,
10
+ }),
11
+ };
12
+ static description = 'Get a Copado user story by ID';
13
+ static examples = [
14
+ '<%= config.bin %> <%= command.id %> a0SKC000000CmZ2AU',
15
+ '<%= config.bin %> <%= command.id %> a0SKC000000CmZ2AU --json',
16
+ ];
17
+ async run() {
18
+ const { args } = await this.parse(WorkGet);
19
+ const userStory = await this.withSpinner('Fetching user story', () => CicdGateway.call({
20
+ endpoint: workEndpoint(args.id),
21
+ method: 'GET',
22
+ }));
23
+ this.display(() => {
24
+ this.log(formatUserStoryDetail(userStory));
25
+ });
26
+ return userStory;
27
+ }
28
+ }
29
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/work/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAA;AAEhC,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAC,qBAAqB,EAAkB,YAAY,EAAC,MAAM,yBAAyB,CAAA;AAE3F,MAAM,CAAC,OAAO,OAAO,OAAQ,SAAQ,cAAc;IACjD,MAAM,CAAU,IAAI,GAAG;QACrB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,WAAW,EAAE,eAAe;YAC5B,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAA;IACD,MAAM,CAAU,WAAW,GAAG,+BAA+B,CAAA;IAC7D,MAAM,CAAU,QAAQ,GAAG;QACzB,uDAAuD;QACvD,8DAA8D;KAC/D,CAAA;IAEM,KAAK,CAAC,GAAG;QACd,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QAExC,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,qBAAqB,EAAE,GAAG,EAAE,CACnE,WAAW,CAAC,IAAI,CAAY;YAC1B,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;YAC/B,MAAM,EAAE,KAAK;SACd,CAAC,CACH,CAAA;QAED,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;YAChB,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,CAAA;QAC5C,CAAC,CAAC,CAAA;QAEF,OAAO,SAAS,CAAA;IAClB,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
2
+ import { type UserStory } from '../../lib/work-types.js';
3
+ export default class WorkList extends AgentiaCommand {
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: {
7
+ readonly 'assigned-to-me': import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ readonly 'assignee-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
9
+ readonly 'assignee-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ readonly name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ readonly 'owned-by-me': import("@oclif/core/interfaces").BooleanFlag<boolean>;
12
+ readonly 'owner-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ readonly 'owner-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ readonly 'project-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ readonly 'project-name': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ readonly status: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ readonly title: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ };
19
+ run(): Promise<UserStory[]>;
20
+ }
@@ -0,0 +1,58 @@
1
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
2
+ import { CicdGateway } from '../../lib/cicd-gateway.js';
3
+ import { getUserContext } from '../../lib/user-context.js';
4
+ import { buildWorkListFilters, workListFilterFlags } from '../../lib/work-flags.js';
5
+ import { formatUserStoryTable, normalizeUserStories, workListEndpoint, } from '../../lib/work-types.js';
6
+ export default class WorkList extends AgentiaCommand {
7
+ static description = 'List Copado user stories';
8
+ static examples = [
9
+ '<%= config.bin %> <%= command.id %>',
10
+ '<%= config.bin %> <%= command.id %> --status "In Progress" --project-name MyProject',
11
+ '<%= config.bin %> <%= command.id %> --assigned-to-me',
12
+ '<%= config.bin %> <%= command.id %> --owned-by-me',
13
+ '<%= config.bin %> <%= command.id %> --json',
14
+ ];
15
+ static flags = workListFilterFlags;
16
+ async run() {
17
+ const { flags } = await this.parse(WorkList);
18
+ const filters = buildWorkListFilters(flags);
19
+ const assignedToMe = flags['assigned-to-me'] === true;
20
+ const ownedByMe = flags['owned-by-me'] === true;
21
+ if (assignedToMe && ownedByMe) {
22
+ this.error('Use either --assigned-to-me or --owned-by-me, not both.', { exit: 2 });
23
+ }
24
+ if (assignedToMe && flags['assignee-id'] !== undefined) {
25
+ this.error('Cannot use --assigned-to-me with --assignee-id.', { exit: 2 });
26
+ }
27
+ if (ownedByMe && flags['owner-id'] !== undefined) {
28
+ this.error('Cannot use --owned-by-me with --owner-id.', { exit: 2 });
29
+ }
30
+ if (assignedToMe || ownedByMe) {
31
+ const userContext = await this.withSpinner('Fetching current user', () => getUserContext());
32
+ const userId = userContext.id;
33
+ if (userId === undefined || userId.trim().length === 0) {
34
+ this.error('Current user ID is unavailable from the CICD gateway context.', { exit: 1 });
35
+ }
36
+ if (assignedToMe) {
37
+ filters.assigneeId = userId;
38
+ }
39
+ else {
40
+ filters.ownerId = userId;
41
+ }
42
+ }
43
+ const response = await this.withSpinner('Fetching user stories', () => CicdGateway.call({
44
+ endpoint: workListEndpoint(filters),
45
+ method: 'GET',
46
+ }));
47
+ const userStories = normalizeUserStories(response);
48
+ this.display(() => {
49
+ if (userStories.length === 0) {
50
+ this.log('No user stories found.');
51
+ return;
52
+ }
53
+ this.log(formatUserStoryTable(userStories));
54
+ });
55
+ return userStories;
56
+ }
57
+ }
58
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/work/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAA;AAC3D,OAAO,EAAC,WAAW,EAAC,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAC,cAAc,EAAC,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAC,oBAAoB,EAAE,mBAAmB,EAAC,MAAM,yBAAyB,CAAA;AACjF,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EAGpB,gBAAgB,GACjB,MAAM,yBAAyB,CAAA;AAEhC,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,cAAc;IAClD,MAAM,CAAU,WAAW,GAAG,0BAA0B,CAAA;IACxD,MAAM,CAAU,QAAQ,GAAG;QACzB,qCAAqC;QACrC,qFAAqF;QACrF,sDAAsD;QACtD,mDAAmD;QACnD,4CAA4C;KAC7C,CAAA;IACD,MAAM,CAAU,KAAK,GAAG,mBAAmB,CAAA;IAEpC,KAAK,CAAC,GAAG;QACd,MAAM,EAAC,KAAK,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;QAC1C,MAAM,OAAO,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAA;QAC3C,MAAM,YAAY,GAAG,KAAK,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAA;QACrD,MAAM,SAAS,GAAG,KAAK,CAAC,aAAa,CAAC,KAAK,IAAI,CAAA;QAE/C,IAAI,YAAY,IAAI,SAAS,EAAE,CAAC;YAC9B,IAAI,CAAC,KAAK,CAAC,yDAAyD,EAAE,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAA;QAClF,CAAC;QAED,IAAI,YAAY,IAAI,KAAK,CAAC,aA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IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;gBAClC,OAAM;YACR,CAAC;YAED,IAAI,CAAC,GAAG,CAAC,oBAAoB,CAAC,WAAW,CAAC,CAAC,CAAA;QAC7C,CAAC,CAAC,CAAA;QAEF,OAAO,WAAW,CAAA;IACpB,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { AgentiaCommand } from '../../lib/agentia-command.js';
2
+ import { type UserStory } from '../../lib/work-types.js';
3
+ export default class WorkUpdate extends AgentiaCommand {
4
+ static args: {
5
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static description: string;
8
+ static examples: string[];
9
+ static flags: {
10
+ readonly 'acceptance-criteria': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ readonly 'as-a': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ readonly assignee: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ readonly 'cancellation-reason': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ readonly 'close-date': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ readonly epic: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ readonly feature: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ readonly 'functional-requirements': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ readonly 'owner-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ readonly project: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ readonly 'record-type': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
+ readonly 'release-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
22
+ readonly 'so-that': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
23
+ readonly 'source-credential': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
24
+ readonly 'source-environment': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
25
+ readonly 'sprint-id': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
26
+ readonly status: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
27
+ readonly team: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
28
+ readonly 'technical-specifications': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
29
+ readonly theme: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
30
+ readonly title: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
31
+ readonly 'want-to': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
32
+ readonly 'actual-points': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
33
+ readonly 'planned-points': import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
34
+ readonly priority: import("@oclif/core/interfaces").OptionFlag<number | undefined, import("@oclif/core/interfaces").CustomOptions>;
35
+ readonly 'excluded-from-cbm': import("@oclif/core/interfaces").BooleanFlag<boolean>;
36
+ };
37
+ run(): Promise<UserStory>;
38
+ }