@microsoft/managed-apps-cli 0.10.0 → 0.11.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 (133) hide show
  1. package/README.md +4 -308
  2. package/dist/ArgumentProvider.d.ts.map +1 -1
  3. package/dist/ArgumentProvider.js +5 -1
  4. package/dist/ArgumentProvider.js.map +1 -1
  5. package/dist/Cli.d.ts.map +1 -1
  6. package/dist/Cli.js +3 -1
  7. package/dist/Cli.js.map +1 -1
  8. package/dist/Constants/CommandRegistry.d.ts +1 -2
  9. package/dist/Constants/CommandRegistry.d.ts.map +1 -1
  10. package/dist/Constants/CommandRegistry.js +27 -27
  11. package/dist/Constants/CommandRegistry.js.map +1 -1
  12. package/dist/Constants/HelpStrings.d.ts +5 -2
  13. package/dist/Constants/HelpStrings.d.ts.map +1 -1
  14. package/dist/Constants/HelpStrings.js +25 -12
  15. package/dist/Constants/HelpStrings.js.map +1 -1
  16. package/dist/Constants.d.ts +1 -1
  17. package/dist/Constants.d.ts.map +1 -1
  18. package/dist/Constants.js +9 -4
  19. package/dist/Constants.js.map +1 -1
  20. package/dist/Errors/GitHubErrorMap.d.ts.map +1 -1
  21. package/dist/Errors/GitHubErrorMap.js +1 -0
  22. package/dist/Errors/GitHubErrorMap.js.map +1 -1
  23. package/dist/Logger/CliLogger.d.ts +1 -0
  24. package/dist/Logger/CliLogger.d.ts.map +1 -1
  25. package/dist/Logger/CliLogger.js +7 -0
  26. package/dist/Logger/CliLogger.js.map +1 -1
  27. package/dist/Logger/ConsoleWriter.d.ts +2 -0
  28. package/dist/Logger/ConsoleWriter.d.ts.map +1 -1
  29. package/dist/Logger/ConsoleWriter.js +17 -7
  30. package/dist/Logger/ConsoleWriter.js.map +1 -1
  31. package/dist/Types/Command.types.d.ts +6 -0
  32. package/dist/Types/Command.types.d.ts.map +1 -1
  33. package/dist/Types/Command.types.js +8 -0
  34. package/dist/Types/Command.types.js.map +1 -1
  35. package/dist/Utils/BuildVerbDescriptionTable.d.ts.map +1 -1
  36. package/dist/Utils/BuildVerbDescriptionTable.js +6 -2
  37. package/dist/Utils/BuildVerbDescriptionTable.js.map +1 -1
  38. package/dist/Utils/ConnectorIds.d.ts +12 -0
  39. package/dist/Utils/ConnectorIds.d.ts.map +1 -0
  40. package/dist/Utils/ConnectorIds.js +20 -0
  41. package/dist/Utils/ConnectorIds.js.map +1 -0
  42. package/dist/Utils/DownloadTemplate.d.ts.map +1 -1
  43. package/dist/Utils/DownloadTemplate.js +7 -5
  44. package/dist/Utils/DownloadTemplate.js.map +1 -1
  45. package/dist/Utils/EnvVars.d.ts +1 -1
  46. package/dist/Utils/EnvVars.d.ts.map +1 -1
  47. package/dist/Utils/EnvVars.js.map +1 -1
  48. package/dist/Utils/EnvironmentRoutingUtils.d.ts +20 -1
  49. package/dist/Utils/EnvironmentRoutingUtils.d.ts.map +1 -1
  50. package/dist/Utils/EnvironmentRoutingUtils.js +78 -3
  51. package/dist/Utils/EnvironmentRoutingUtils.js.map +1 -1
  52. package/dist/Utils/GitErrorClassifier.d.ts +40 -0
  53. package/dist/Utils/GitErrorClassifier.d.ts.map +1 -0
  54. package/dist/Utils/GitErrorClassifier.js +120 -0
  55. package/dist/Utils/GitErrorClassifier.js.map +1 -0
  56. package/dist/Utils/GitRunner.d.ts +107 -0
  57. package/dist/Utils/GitRunner.d.ts.map +1 -0
  58. package/dist/Utils/GitRunner.js +89 -0
  59. package/dist/Utils/GitRunner.js.map +1 -0
  60. package/dist/Utils/GitUtils.d.ts +12 -0
  61. package/dist/Utils/GitUtils.d.ts.map +1 -1
  62. package/dist/Utils/GitUtils.js +83 -20
  63. package/dist/Utils/GitUtils.js.map +1 -1
  64. package/dist/Utils/GitVersionChecker.d.ts.map +1 -1
  65. package/dist/Utils/GitVersionChecker.js +11 -8
  66. package/dist/Utils/GitVersionChecker.js.map +1 -1
  67. package/dist/Utils/Paging.d.ts +1 -0
  68. package/dist/Utils/Paging.d.ts.map +1 -1
  69. package/dist/Utils/Paging.js +7 -1
  70. package/dist/Utils/Paging.js.map +1 -1
  71. package/dist/Utils/RepoDetails.d.ts +29 -0
  72. package/dist/Utils/RepoDetails.d.ts.map +1 -0
  73. package/dist/Utils/RepoDetails.js +37 -0
  74. package/dist/Utils/RepoDetails.js.map +1 -0
  75. package/dist/Utils/ResolveCommand.d.ts.map +1 -1
  76. package/dist/Utils/ResolveCommand.js +6 -4
  77. package/dist/Utils/ResolveCommand.js.map +1 -1
  78. package/dist/Verbs/AddConnector.d.ts +1 -1
  79. package/dist/Verbs/AddConnector.d.ts.map +1 -1
  80. package/dist/Verbs/AddConnector.js +13 -7
  81. package/dist/Verbs/AddConnector.js.map +1 -1
  82. package/dist/Verbs/AddConnectorFlows.d.ts +2 -2
  83. package/dist/Verbs/AddConnectorFlows.d.ts.map +1 -1
  84. package/dist/Verbs/AddConnectorFlows.js +11 -13
  85. package/dist/Verbs/AddConnectorFlows.js.map +1 -1
  86. package/dist/Verbs/AddDataSource.js +1 -1
  87. package/dist/Verbs/AddDataSource.js.map +1 -1
  88. package/dist/Verbs/AddTable.js +1 -1
  89. package/dist/Verbs/AddTable.js.map +1 -1
  90. package/dist/Verbs/ConnectorHelpers.d.ts +2 -0
  91. package/dist/Verbs/ConnectorHelpers.d.ts.map +1 -1
  92. package/dist/Verbs/ConnectorHelpers.js +7 -1
  93. package/dist/Verbs/ConnectorHelpers.js.map +1 -1
  94. package/dist/Verbs/CreateMaafApp.d.ts +25 -13
  95. package/dist/Verbs/CreateMaafApp.d.ts.map +1 -1
  96. package/dist/Verbs/CreateMaafApp.js +265 -116
  97. package/dist/Verbs/CreateMaafApp.js.map +1 -1
  98. package/dist/Verbs/GetMaafApp.d.ts.map +1 -1
  99. package/dist/Verbs/GetMaafApp.js +10 -0
  100. package/dist/Verbs/GetMaafApp.js.map +1 -1
  101. package/dist/Verbs/Init.d.ts.map +1 -1
  102. package/dist/Verbs/Init.js +36 -21
  103. package/dist/Verbs/Init.js.map +1 -1
  104. package/dist/Verbs/ListConnectors.d.ts.map +1 -1
  105. package/dist/Verbs/ListConnectors.js +1 -0
  106. package/dist/Verbs/ListConnectors.js.map +1 -1
  107. package/dist/Verbs/MaafAppPermissions.d.ts.map +1 -1
  108. package/dist/Verbs/MaafAppPermissions.js +87 -15
  109. package/dist/Verbs/MaafAppPermissions.js.map +1 -1
  110. package/dist/Verbs/Pack.d.ts +1 -1
  111. package/dist/Verbs/RefreshDataSource.js +1 -1
  112. package/dist/Verbs/RefreshDataSource.js.map +1 -1
  113. package/dist/Verbs/{DeleteDataSource.d.ts → RemoveDataSource.d.ts} +2 -2
  114. package/dist/Verbs/RemoveDataSource.d.ts.map +1 -0
  115. package/dist/Verbs/RemoveDataSource.js +158 -0
  116. package/dist/Verbs/RemoveDataSource.js.map +1 -0
  117. package/dist/Verbs/ShareLinkList.js +1 -1
  118. package/dist/Verbs/ShareLinkList.js.map +1 -1
  119. package/dist/Verbs/ShowMaafApp.d.ts +6 -0
  120. package/dist/Verbs/ShowMaafApp.d.ts.map +1 -1
  121. package/dist/Verbs/ShowMaafApp.js +8 -0
  122. package/dist/Verbs/ShowMaafApp.js.map +1 -1
  123. package/dist/Verbs/VerbConstants.d.ts +1 -1
  124. package/dist/Verbs/VerbConstants.js +1 -1
  125. package/dist/Verbs/VerbConstants.js.map +1 -1
  126. package/dist/Verbs/index.d.ts +1 -1
  127. package/dist/Verbs/index.d.ts.map +1 -1
  128. package/dist/Verbs/index.js +1 -1
  129. package/dist/Verbs/index.js.map +1 -1
  130. package/package.json +5 -5
  131. package/dist/Verbs/DeleteDataSource.d.ts.map +0 -1
  132. package/dist/Verbs/DeleteDataSource.js +0 -105
  133. package/dist/Verbs/DeleteDataSource.js.map +0 -1
@@ -0,0 +1,89 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { execFileSync } from 'child_process';
5
+ import { classifyLocalGitError } from './GitErrorClassifier.js';
6
+ function toStr(value) {
7
+ if (value == null)
8
+ return '';
9
+ return Buffer.isBuffer(value) ? value.toString() : value;
10
+ }
11
+ /**
12
+ * Explicit stdout/stderr capture ceiling for every git invocation. Node's
13
+ * `execFileSync` defaults to a 1 MB `maxBuffer`; exceeding it throws `ENOBUFS`
14
+ * (treated by callers as a generic failure). `ls-tree -r HEAD` on a large repo,
15
+ * or verbose clone/fetch progress, can blow past 1 MB — and an `allowFailure`
16
+ * probe would silently misread that `ENOBUFS` as its expected control-flow
17
+ * signal (e.g. "repo is empty"). A generous ceiling avoids those spurious
18
+ * failures while still guarding against runaway memory.
19
+ */
20
+ const GIT_MAX_BUFFER_BYTES = 64 * 1024 * 1024;
21
+ /**
22
+ * Single chokepoint for every `git` invocation in the CLI.
23
+ *
24
+ * Centralizing git here gives one stdio policy (stdin ignored so a child can
25
+ * never block waiting for input; stderr piped so a *failure's* output is
26
+ * captured rather than lost to an inherited stream) and one place to hang
27
+ * pre/post checks on. Because `execFileSync` only surfaces stderr via the
28
+ * thrown error, capture applies to the failure path: on failure the captured
29
+ * stderr is re-emitted by default so users still see git's own message, and is
30
+ * also returned (on `allowFailure`) or attached to the thrown error
31
+ * (`error.stderr`) for classification. A *successful* piped op's stderr is not
32
+ * captured (it is discarded). The one exception to piping is an un-classified,
33
+ * non-probe {@link RunGitOptions.network} op, whose stderr is inherited so live
34
+ * progress and credential prompts stream straight through on success too.
35
+ *
36
+ * On failure with `allowFailure: false` (the default), the *original* error is
37
+ * re-thrown so existing message-based handling keeps working — the caught error
38
+ * now additionally carries a populated `stderr` because we pipe it.
39
+ */
40
+ export function runGit(args, options = {}) {
41
+ const { cwd, allowFailure = false, captureStdout = false, emitStderr = true, classify, network = false, } = options;
42
+ // A network op that is neither classified nor a silent probe streams git's
43
+ // stderr live (progress + interactive credential prompts) instead of
44
+ // buffering it; every other case pipes stderr so it can be captured for
45
+ // classification or returned to the caller.
46
+ const inheritStderr = network && !classify && !allowFailure;
47
+ try {
48
+ const stdout = execFileSync('git', args, {
49
+ cwd,
50
+ stdio: ['ignore', captureStdout ? 'pipe' : 'ignore', inheritStderr ? 'inherit' : 'pipe'],
51
+ maxBuffer: GIT_MAX_BUFFER_BYTES,
52
+ });
53
+ return {
54
+ success: true,
55
+ status: 0,
56
+ stdout: captureStdout ? toStr(stdout) : '',
57
+ stderr: '',
58
+ };
59
+ }
60
+ catch (err) {
61
+ const e = err;
62
+ const stderr = toStr(e.stderr);
63
+ // Classification runs on the throwing path only, and BEFORE we re-emit
64
+ // stderr: a recognized failure is re-thrown as a typed AppError whose
65
+ // message already embeds git's output, so emitting stderr here too would
66
+ // double-print it (the top-level catch prints the thrown message).
67
+ if (classify && !allowFailure) {
68
+ const text = stderr || toStr(e.stdout) || (err instanceof Error ? err.message : String(err));
69
+ const classified = classifyLocalGitError(text, classify);
70
+ if (classified) {
71
+ throw classified;
72
+ }
73
+ }
74
+ if (emitStderr && stderr) {
75
+ process.stderr.write(stderr);
76
+ }
77
+ if (!allowFailure) {
78
+ throw err;
79
+ }
80
+ return {
81
+ success: false,
82
+ status: typeof e.status === 'number' ? e.status : null,
83
+ stdout: toStr(e.stdout),
84
+ stderr,
85
+ error: err instanceof Error ? err : new Error(String(err)),
86
+ };
87
+ }
88
+ }
89
+ //# sourceMappingURL=GitRunner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitRunner.js","sourceRoot":"","sources":["../../src/Utils/GitRunner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,OAAO,EAAE,qBAAqB,EAA2B,MAAM,sBAAsB,CAAC;AAwFtF,SAAS,KAAK,CAAC,KAAyC;IACtD,IAAI,KAAK,IAAI,IAAI;QAAE,OAAO,EAAE,CAAC;IAC7B,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AAC3D,CAAC;AAED;;;;;;;;GAQG;AAC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AC,IAAI,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAC7F,MAAM,UAAU,GAAG,qBAAqB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YACzD,IAAI,UAAU,EAAE,CAAC;gBACf,MAAM,UAAU,CAAC;YACnB,CAAC;QACH,CAAC;QAED,IAAI,UAAU,IAAI,MAAM,EAAE,CAAC;YACzB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC/B,CAAC;QAED,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,GAAG,CAAC;QACZ,CAAC;QAED,OAAO;YACL,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,OAAO,CAAC,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI;YACtD,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;YACvB,MAAM;YACN,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SAC3D,CAAC;IACJ,CAAC;AACH,CAAC"}
@@ -6,6 +6,10 @@ export interface GitDefaults {
6
6
  commitSha: string;
7
7
  detached: boolean;
8
8
  }
9
+ export interface InitializeLocalGitRepoResult {
10
+ success: boolean;
11
+ error?: string;
12
+ }
9
13
  /**
10
14
  * Reads the current branch and commit SHA from the working directory's git repo.
11
15
  * Returns null when git is unavailable or the directory is not a git repo.
@@ -18,6 +22,14 @@ export declare function resolveGitDefaults(): GitDefaults | null;
18
22
  * Returns null when git is unavailable or the directory is not a git repo
19
23
  */
20
24
  export declare function getCurrentGitRemoteUrl(): string | undefined;
25
+ /**
26
+ * Initializes a local git repository in the current working directory and
27
+ * optionally configures the origin remote in the supplied working directory.
28
+ * Returns true when `git init` succeeds, false when git is unavailable or the
29
+ * command fails for any reason (e.g. permissions). Callers should treat false as
30
+ * a soft failure — the app was already created; git can be initialized manually.
31
+ */
32
+ export declare function initializeLocalGitRepo(remoteUrl?: string, cwd?: string): InitializeLocalGitRepoResult;
21
33
  /**
22
34
  * Returns true when the working tree has uncommitted changes (staged, unstaged, or untracked).
23
35
  * Returns null when git is unavailable or the directory is not a git repo, so callers can skip
@@ -1 +1 @@
1
- {"version":3,"file":"GitUtils.d.ts","sourceRoot":"","sources":["../../src/Utils/GitUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,WAAW,GAAG,IAAI,CAQvD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,GAAG,SAAS,CAS3D;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,GAAG,IAAI,CAOtD"}
1
+ {"version":3,"file":"GitUtils.d.ts","sourceRoot":"","sources":["../../src/Utils/GitUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,4BAA4B;IAC3C,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,WAAW,GAAG,IAAI,CAkBvD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,IAAI,MAAM,GAAG,SAAS,CAQ3D;AA0BD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,CAAC,EAAE,MAAM,EAClB,GAAG,SAAgB,GAClB,4BAA4B,CA0B9B;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,GAAG,IAAI,CAQtD"}
@@ -1,7 +1,8 @@
1
1
  /*!
2
2
  * Copyright (C) Microsoft Corporation. All rights reserved.
3
3
  */
4
- import { execSync } from 'child_process';
4
+ import { execFileSync } from 'child_process';
5
+ import { runGit } from './GitRunner.js';
5
6
  /**
6
7
  * Reads the current branch and commit SHA from the working directory's git repo.
7
8
  * Returns null when git is unavailable or the directory is not a git repo.
@@ -9,28 +10,89 @@ import { execSync } from 'child_process';
9
10
  * literal string 'HEAD' and callers should not treat it as a branch name.
10
11
  */
11
12
  export function resolveGitDefaults() {
12
- try {
13
- const commitSha = execSync('git rev-parse HEAD', { stdio: 'pipe' }).toString().trim();
14
- const branch = execSync('git rev-parse --abbrev-ref HEAD', { stdio: 'pipe' }).toString().trim();
15
- return { branch, commitSha, detached: branch === 'HEAD' };
16
- }
17
- catch {
13
+ const sha = runGit(['rev-parse', 'HEAD'], {
14
+ captureStdout: true,
15
+ allowFailure: true,
16
+ emitStderr: false,
17
+ });
18
+ if (!sha.success)
18
19
  return null;
19
- }
20
+ const ref = runGit(['rev-parse', '--abbrev-ref', 'HEAD'], {
21
+ captureStdout: true,
22
+ allowFailure: true,
23
+ emitStderr: false,
24
+ });
25
+ if (!ref.success)
26
+ return null;
27
+ const commitSha = sha.stdout.trim();
28
+ const branch = ref.stdout.trim();
29
+ return { branch, commitSha, detached: branch === 'HEAD' };
20
30
  }
21
31
  /**
22
32
  * Reads the current git remote origin URL from the working directory's git repo.
23
33
  * Returns null when git is unavailable or the directory is not a git repo
24
34
  */
25
35
  export function getCurrentGitRemoteUrl() {
36
+ const result = runGit(['config', '--get', 'remote.origin.url'], {
37
+ captureStdout: true,
38
+ allowFailure: true,
39
+ emitStderr: false,
40
+ });
41
+ if (!result.success)
42
+ return undefined;
43
+ return result.stdout.trim() || undefined;
44
+ }
45
+ // Only allow transport schemes the platform actually returns: HTTPS clone URLs
46
+ // (native Azure DevOps and GitHub HTTPS) and SSH clone URLs. This blocks git's
47
+ // `ext::`, `fd::`, and similar protocols that can spawn external commands as
48
+ // transport helpers without the shell ever being involved.
49
+ const allowedGitRemoteSchemes = ['https://', 'ssh://', 'git@'];
50
+ function isSafeGitRemoteUrl(remoteUrl) {
51
+ return (allowedGitRemoteSchemes.some((scheme) => remoteUrl.startsWith(scheme)) &&
52
+ remoteUrl.trim() === remoteUrl &&
53
+ !remoteUrl.startsWith('-') &&
54
+ !/[\r\n\0]/.test(remoteUrl));
55
+ }
56
+ // A failing `execFileSync` sets `error.message` to
57
+ // "Command failed: git remote add origin <url>", embedding the remote URL
58
+ // verbatim. If that URL ever carries credentials (e.g. https://<PAT>@host/...),
59
+ // returning the raw message would leak the secret into telemetry. Redact any
60
+ // userinfo segment before surfacing the error to callers.
61
+ function scrubGitErrorMessage(message) {
62
+ return message.replace(/:\/\/[^@\s/]+@/g, '://[REDACTED]@');
63
+ }
64
+ /**
65
+ * Initializes a local git repository in the current working directory and
66
+ * optionally configures the origin remote in the supplied working directory.
67
+ * Returns true when `git init` succeeds, false when git is unavailable or the
68
+ * command fails for any reason (e.g. permissions). Callers should treat false as
69
+ * a soft failure — the app was already created; git can be initialized manually.
70
+ */
71
+ export function initializeLocalGitRepo(remoteUrl, cwd = process.cwd()) {
26
72
  try {
27
- const remoteUrl = execSync('git config --get remote.origin.url', { stdio: 'pipe' })
28
- .toString()
29
- .trim();
30
- return remoteUrl || undefined;
73
+ if (remoteUrl !== undefined && !isSafeGitRemoteUrl(remoteUrl)) {
74
+ return {
75
+ success: false,
76
+ error: 'Unsafe git remote URL.',
77
+ };
78
+ }
79
+ execFileSync('git', ['init'], { stdio: 'pipe', windowsHide: true, cwd });
80
+ if (remoteUrl) {
81
+ execFileSync('git', ['remote', 'add', 'origin', remoteUrl], {
82
+ stdio: 'pipe',
83
+ windowsHide: true,
84
+ cwd,
85
+ });
86
+ }
87
+ return {
88
+ success: true,
89
+ };
31
90
  }
32
- catch {
33
- return undefined;
91
+ catch (error) {
92
+ return {
93
+ success: false,
94
+ error: scrubGitErrorMessage(error instanceof Error ? error.message : String(error)),
95
+ };
34
96
  }
35
97
  }
36
98
  /**
@@ -39,12 +101,13 @@ export function getCurrentGitRemoteUrl() {
39
101
  * the check rather than treat it as a clean tree.
40
102
  */
41
103
  export function hasUncommittedChanges() {
42
- try {
43
- const status = execSync('git status --porcelain', { stdio: 'pipe' }).toString().trim();
44
- return status.length > 0;
45
- }
46
- catch {
104
+ const result = runGit(['status', '--porcelain'], {
105
+ captureStdout: true,
106
+ allowFailure: true,
107
+ emitStderr: false,
108
+ });
109
+ if (!result.success)
47
110
  return null;
48
- }
111
+ return result.stdout.trim().length > 0;
49
112
  }
50
113
  //# sourceMappingURL=GitUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GitUtils.js","sourceRoot":"","sources":["../../src/Utils/GitUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQzC;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB;IAChC,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,QAAQ,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;QACtF,MAAM,MAAM,GAAG,QAAQ,CAAC,iCAAiC,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;QAChG,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,EAAE,CAAC;IAC5D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB;IACpC,IAAI,CAAC;QACH,MAAM,SAAS,G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M,GAAG,CAAC,CAAC;AACzC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"GitVersionChecker.d.ts","sourceRoot":"","sources":["../../src/Utils/GitVersionChecker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAmBzC"}
1
+ {"version":3,"file":"GitVersionChecker.d.ts","sourceRoot":"","sources":["../../src/Utils/GitVersionChecker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAuBzC"}
@@ -1,10 +1,10 @@
1
1
  /*!
2
2
  * Copyright (C) Microsoft Corporation. All rights reserved.
3
3
  */
4
- import { execFileSync } from 'child_process';
5
4
  import semver from 'semver';
6
5
  import packageJson from '../../package.json' with { type: 'json' };
7
6
  import { ConfigurationError } from '../Errors/CliError.js';
7
+ import { runGit } from './GitRunner.js';
8
8
  /**
9
9
  * Preflight guard for `ms app create`: throws `ConfigurationError` when `git` is
10
10
  * missing from PATH, or present but older than this package's `engines.git`
@@ -39,15 +39,18 @@ import { ConfigurationError } from '../Errors/CliError.js';
39
39
  * format we couldn't predict.
40
40
  */
41
41
  export function ensureGitInstalled() {
42
- let versionOutput;
43
- try {
44
- versionOutput = execFileSync('git', ['--version'], {
45
- stdio: ['ignore', 'pipe', 'ignore'],
46
- }).toString();
47
- }
48
- catch {
42
+ // `runGit` with allowFailure turns a missing-git spawn failure into a
43
+ // structured result instead of a throw; emitStderr is off because we own the
44
+ // user-facing message here (the raw "command not found" stderr would be noise).
45
+ const result = runGit(['--version'], {
46
+ captureStdout: true,
47
+ allowFailure: true,
48
+ emitStderr: false,
49
+ });
50
+ if (!result.success) {
49
51
  throw new ConfigurationError("'git' is required but was not found on PATH.");
50
52
  }
53
+ const versionOutput = result.stdout;
51
54
  const required = packageJson.engines.git;
52
55
  if (!semver.validRange(required))
53
56
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"GitVersionChecker.js","sourceRoot":"","sources":["../../src/Utils/GitVersionChecker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,WAAW,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,kBAAkB;IAChC,IAAI,aAAqB,CAAC;IAC1B,IAAI,CAAC;QACH,aAAa,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE;YACjD,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;SACpC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,kBAAkB,CAAC,8CAA8C,CAAC,CAAC;IAC/E,CAAC;IAED,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC;IACzC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO;IACzC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC3C,IAAI,CAAC,KAAK;QAAE,OAAO;IACnB,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC;QAAE,OAAO;IAE9C,MAAM,IAAI,kBAAkB,CAC1B,OAAO,QAAQ,uBAAuB,KAAK,CAAC,OAAO,wBAAwB,CAC5E,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"GitVersionChecker.js","sourceRoot":"","sources":["../../src/Utils/GitVersionChecker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,WAAW,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,kBAAkB;IAChC,sEAAsE;IACtE,6EAA6E;IAC7E,gFAAgF;IAChF,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,WAAW,CAAC,EAAE;QACnC,aAAa,EAAE,IAAI;QACnB,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,KAAK;KAClB,CAAC,CAAC;IACH,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,kBAAkB,CAAC,8CAA8C,CAAC,CAAC;IAC/E,CAAC;IACD,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IAEpC,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC;IACzC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO;IACzC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC3C,IAAI,CAAC,KAAK;QAAE,OAAO;IACnB,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC;QAAE,OAAO;IAE9C,MAAM,IAAI,kBAAkB,CAC1B,OAAO,QAAQ,uBAAuB,KAAK,CAAC,OAAO,wBAAwB,CAC5E,CAAC;AACJ,CAAC"}
@@ -24,5 +24,6 @@ export declare function printPagedTable(options: {
24
24
  rows: string[][];
25
25
  emptyMessage?: string;
26
26
  totalLabel: string;
27
+ hint?: string;
27
28
  }): Promise<void>;
28
29
  //# sourceMappingURL=Paging.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Paging.d.ts","sourceRoot":"","sources":["../../src/Utils/Paging.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,eAAO,MAAM,SAAS,KAAK,CAAC;AAE5B;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,CA2BnE;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BhE;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BhB"}
1
+ {"version":3,"file":"Paging.d.ts","sourceRoot":"","sources":["../../src/Utils/Paging.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAGjD,eAAO,MAAM,SAAS,KAAK,CAAC;AAE5B;;;GAGG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,CA2BnE;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA4BhE;AAED;;;GAGG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,IAAI,CAAC,CAkChB"}
@@ -69,11 +69,14 @@ export async function printPagedText(text) {
69
69
  * or a single full table in non-TTY/piped mode.
70
70
  */
71
71
  export async function printPagedTable(options) {
72
- const { title, metadata, columns, rows, emptyMessage, totalLabel } = options;
72
+ const { title, metadata, columns, rows, emptyMessage, totalLabel, hint } = options;
73
73
  const total = rows.length;
74
74
  if (!process.stdout.isTTY) {
75
75
  printTable({ title, metadata, columns, rows, emptyMessage });
76
76
  console.log(styleText('dim', ` Showing ${total} of ${total} ${totalLabel}`));
77
+ if (hint) {
78
+ console.log(styleText('dim', ` ${hint}`));
79
+ }
77
80
  return;
78
81
  }
79
82
  const totalPages = Math.max(1, Math.ceil(total / PAGE_SIZE));
@@ -83,6 +86,9 @@ export async function printPagedTable(options) {
83
86
  const isLastPage = page === totalPages - 1;
84
87
  printTable({ title, metadata, columns, rows: pageRows, emptyMessage });
85
88
  console.log(styleText('dim', ` Showing ${start + pageRows.length} of ${total} ${totalLabel}`));
89
+ if (hint) {
90
+ console.log(styleText('dim', ` ${hint}`));
91
+ }
86
92
  if (!isLastPage) {
87
93
  console.log(styleText('dim', ' Press Enter for more, Esc or q to exit'));
88
94
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Paging.js","sourceRoot":"","sources":["../../src/Utils/Paging.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAGrC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,CAAC;AAE5B;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC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AE,aAAa,KAAK,GAAG,QAAQ,CAAC,MAAM,OAAO,KAAK,IAAI,UAAU,EAAE,CAAC,CAAC,CAAC;QAChG,IAAI,IAAI,EAAE,CAAC;YACT,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;QAC7C,CAAC;QACD,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,0CAA0C,CAAC,CAAC,CAAC;QAC5E,CAAC;QAED,IAAI,UAAU;YAAE,MAAM;QAEtB,MAAM,MAAM,GAAG,MAAM,cAAc,EAAE,CAAC;QACtC,IAAI,MAAM,KAAK,MAAM;YAAE,MAAM;IAC/B,CAAC;AACH,CAAC"}
@@ -0,0 +1,29 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import type { MaafAppDefinition, ManagedAppRepoType } from '@microsoft/managed-apps-actions';
5
+ /** Display-ready repository classification + clone URL derived from a `MaafAppDefinition`. */
6
+ export type RepoDetails = {
7
+ /**
8
+ * Repository-type label for display. Known {@link ManagedAppRepoType} values
9
+ * are mapped to friendly labels; unknown/forward-compat values pass through
10
+ * as the raw server string (see {@link friendlyRepoType}).
11
+ */
12
+ repoType?: string;
13
+ /** Git clone URL for the backing repository, when applicable. */
14
+ cloneUrl?: string;
15
+ };
16
+ /**
17
+ * Maps the raw {@link ManagedAppRepoType} enum returned by the server to a
18
+ * human-friendly label for display. Unknown/forward-compat values fall through
19
+ * to the raw string; `undefined` (legacy apps with no source-control metadata)
20
+ * yields `undefined` so callers can omit the line entirely.
21
+ */
22
+ export declare function friendlyRepoType(repoType: ManagedAppRepoType | undefined): string | undefined;
23
+ /**
24
+ * Derives the display-ready {@link RepoDetails} from an app definition. Returns
25
+ * `undefined` when the app exposes no source-control metadata at all (no
26
+ * `repoType` and no `cloneUrl`), so callers can omit the lines entirely.
27
+ */
28
+ export declare function toRepoDetails(app: Pick<MaafAppDefinition, 'repoType' | 'cloneUrl'>): RepoDetails | undefined;
29
+ //# sourceMappingURL=RepoDetails.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RepoDetails.d.ts","sourceRoot":"","sources":["../../src/Utils/RepoDetails.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAE7F,8FAA8F;AAC9F,MAAM,MAAM,WAAW,GAAG;IACxB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAa7F;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,GAAG,EAAE,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,UAAU,CAAC,GACpD,WAAW,GAAG,SAAS,CAOzB"}
@@ -0,0 +1,37 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ /**
5
+ * Maps the raw {@link ManagedAppRepoType} enum returned by the server to a
6
+ * human-friendly label for display. Unknown/forward-compat values fall through
7
+ * to the raw string; `undefined` (legacy apps with no source-control metadata)
8
+ * yields `undefined` so callers can omit the line entirely.
9
+ */
10
+ export function friendlyRepoType(repoType) {
11
+ switch (repoType) {
12
+ case undefined:
13
+ return undefined;
14
+ case 'Native':
15
+ return 'Platform-managed Git repository';
16
+ case 'ExternallyProvidedBuild':
17
+ return 'Externally provided build (no source)';
18
+ case 'ExternalGitProviderBound':
19
+ return 'External Git provider';
20
+ default:
21
+ return repoType;
22
+ }
23
+ }
24
+ /**
25
+ * Derives the display-ready {@link RepoDetails} from an app definition. Returns
26
+ * `undefined` when the app exposes no source-control metadata at all (no
27
+ * `repoType` and no `cloneUrl`), so callers can omit the lines entirely.
28
+ */
29
+ export function toRepoDetails(app) {
30
+ const repoType = friendlyRepoType(app.repoType);
31
+ const cloneUrl = app.cloneUrl ?? undefined;
32
+ if (!repoType && !cloneUrl) {
33
+ return undefined;
34
+ }
35
+ return { repoType, cloneUrl };
36
+ }
37
+ //# sourceMappingURL=RepoDetails.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RepoDetails.js","sourceRoot":"","sources":["../../src/Utils/RepoDetails.ts"],"names":[],"mappings":"AAAA;;GAEG;AAgBH;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAwC;IACvE,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,QAAQ;YACX,OAAO,iCAAiC,CAAC;QAC3C,KAAK,yBAAyB;YAC5B,OAAO,uCAAuC,CAAC;QACjD,KAAK,0BAA0B;YAC7B,OAAO,uBAAuB,CAAC;QACjC;YACE,OAAO,QAAQ,CAAC;IACpB,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,GAAqD;IAErD,MAAM,QAAQ,GAAG,gBAAgB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,IAAI,SAAS,CAAC;IAC3C,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAChC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ResolveCommand.d.ts","sourceRoot":"","sources":["../../src/Utils/ResolveCommand.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAEV,WAAW,EAEX,OAAO,EACP,eAAe,EAEhB,MAAM,wBAAwB,CAAC;AAGhC;;;;;;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SAAS,MAAM,EAAE,EACvB,IAAI,EAAE,WAAW,GAChB,mBAAmB,GAAG,IAAI,CA8B5B;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,KAAK,IAAI,OAAO,CAE9E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAK1F"}
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Copyright (C) Microsoft Corporation. All rights reserved.
3
3
  */
4
- import { hasParentHandler, isTypedVerbDef } from '../Types/Command.types.js';
4
+ import { getCommandEntry, hasParentHandler, isTypedVerbDef } from '../Types/Command.types.js';
5
5
  /**
6
6
  * Resolves command-line tokens against the command tree.
7
7
  *
@@ -57,7 +57,7 @@ function walkCommands(commands, tokens, index, path) {
57
57
  const token = tokens[index];
58
58
  if (token.startsWith('-'))
59
59
  return null;
60
- const entry = commands[token];
60
+ const entry = getCommandEntry(commands, token);
61
61
  if (!entry)
62
62
  return null;
63
63
  const nextPath = [...path, token];
@@ -65,7 +65,9 @@ function walkCommands(commands, tokens, index, path) {
65
65
  return { path: nextPath, handler: entry.handler, tokensConsumed: index + 1 };
66
66
  }
67
67
  const next = tokens[index + 1];
68
- const nextIsKnownSub = next !== undefined && !next.startsWith('-') && next in entry.commands;
68
+ const nextIsKnownSub = next !== undefined &&
69
+ !next.startsWith('-') &&
70
+ getCommandEntry(entry.commands, next) !== undefined;
69
71
  if (nextIsKnownSub) {
70
72
  return walkCommands(entry.commands, tokens, index + 1, nextPath);
71
73
  }
@@ -104,7 +106,7 @@ export function findIncompleteTypedPath(argv, tree) {
104
106
  const pathTokens = [noun];
105
107
  let inTypedGroup = false;
106
108
  for (const token of rest) {
107
- const entry = commands[token];
109
+ const entry = getCommandEntry(commands, token);
108
110
  if (!entry) {
109
111
  return inTypedGroup ? { pathTokens,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E,IAAiB;IAC1D,OAAO,KAAK,IAAI,IAAI,CAAC;AACvB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,IAAY,EAAE,IAAiB;IAC/E,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IAC3B,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACzC,OAAO,SAAS,KAAK,SAAS,IAAI,cAAc,CAAC,SAAS,CAAC,CAAC;AAC9D,CAAC"}
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import type { ArgumentProvider } from '../ArgumentProvider.js';
5
5
  /**
6
- * `ms app add connector` — a single entry point that adds a connector to
6
+ * `ms app add data-source` — a single entry point that adds a connector to
7
7
  * the app and picks the right shape (table or action) based on the
8
8
  * connector's capabilities.
9
9
  *
@@ -1 +1 @@
1
- {"version":3,"file":"AddConnector.d.ts","sourceRoot":"","sources":["../../src/Verbs/AddConnector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAkB5D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,iBAAiB,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgGzF"}
1
+ {"version":3,"file":"AddConnector.d.ts","sourceRoot":"","sources":["../../src/Verbs/AddConnector.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAkB5D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,iBAAiB,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CA8FzF"}
@@ -5,13 +5,13 @@ import { getSettings } from '../CliSettings.js';
5
5
  import { createDefaultStringOption, promptConfirm } from '../CliUtils.js';
6
6
  import { HelpStrings } from '../Constants/HelpStrings.js';
7
7
  import { UsageError } from '../Errors/CliError.js';
8
+ import { isCdsConnectorId } from '../Utils/ConnectorIds.js';
8
9
  import { isTabularConnector, runAddActionFlowAsync, runAddTableFlowAsync, } from './AddConnectorFlows.js';
9
10
  import { runConnectorDlpPreflightAsync } from './ConnectorHelpers.js';
10
11
  import { AddConnectorArguments, SharedArguments } from './VerbConstants.js';
11
- const COMMON_DATA_SERVICE_FOR_APPS_API_ID = 'shared_commondataserviceforapps';
12
12
  const DATAVERSE_PAIR_ERROR = '--dataverse-environment-id and --table must be specified together for the Common Data Service for Apps connector. Provide both or neither.';
13
13
  /**
14
- * `ms app add connector` — a single entry point that adds a connector to
14
+ * `ms app add data-source` — a single entry point that adds a connector to
15
15
  * the app and picks the right shape (table or action) based on the
16
16
  * connector's capabilities.
17
17
  *
@@ -60,8 +60,7 @@ export async function addConnectorAsync(argumentProvider) {
60
60
  asFlag,
61
61
  connectorLabel,
62
62
  });
63
- const isCommonDataServiceForApps = apiId.toLowerCase() === COMMON_DATA_SERVICE_FOR_APPS_API_ID ||
64
- apiId.toLowerCase().endsWith(`/${COMMON_DATA_SERVICE_FOR_APPS_API_ID}`);
63
+ const isCommonDataServiceForApps = isCdsConnectorId(apiId);
65
64
  // ── CDS connector special case: reinterpret --table as Dataverse logical name ─
66
65
  // For the Common Data Service for Apps connector, `--table` (existing flag) carries
67
66
  // the Dataverse entity logical name and pairs with `--dataverse-environment-id`. The
@@ -79,7 +78,7 @@ export async function addConnectorAsync(argumentProvider) {
79
78
  }
80
79
  }
81
80
  else if (!isCommonDataServiceForApps && dataverseEnvironmentIdFlag) {
82
- throw new UsageError('--dataverse-environment-id can only be used with --connector shared_commondataserviceforapps.');
81
+ throw new UsageError('--dataverse-environment-id can only be used with the Common Data Service for Apps connector (--connector shared_commondataserviceforapps or --connector commondataserviceforapps).');
83
82
  }
84
83
  // ── Reject contradictory flags when adding actions (CDS already handled above) ─
85
84
  if (mode === 'action' && !isCommonDataServiceForApps && (datasetFlag || tableFlag)) {
@@ -135,8 +134,15 @@ async function resolveModeAsync(input) {
135
134
  return addAsTable ? 'table' : 'action';
136
135
  }
137
136
  function createOptionSchema(argumentProvider) {
138
- argumentProvider.setDescription(HelpStrings.app.add.connector.description);
139
- argumentProvider.addExamples(HelpStrings.app.add.connector.examples);
137
+ const invokedAsConnector = argumentProvider.getResolvedCommand()?.path.at(-1) === 'connector';
138
+ if (invokedAsConnector) {
139
+ argumentProvider.setDescription(`${HelpStrings.app.add.connector.deprecation}\n\n${HelpStrings.app.add.connector.description}`);
140
+ argumentProvider.addExamples(HelpStrings.app.add.connector.deprecatedExamples);
141
+ }
142
+ else {
143
+ argumentProvider.setDescription(HelpStrings.app.add.connector.description);
144
+ argumentProvider.addExamples(HelpStrings.app.add.connector.examples);
145
+ }
140
146
  argumentProvider.addOptions([
141
147
  createDefaultStringOption({
142
148
  flags: { key: SharedArguments.Connector.name },