codebuff 1.0.290 → 1.0.291

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 (46) hide show
  1. package/dist/cli-handlers/checkpoint.d.ts +1 -1
  2. package/dist/cli.d.ts +1 -1
  3. package/dist/cli.js +1 -1
  4. package/dist/client.d.ts +4 -4
  5. package/dist/common/actions.d.ts +144 -144
  6. package/dist/common/db/schema.d.ts +1 -1
  7. package/dist/common/types/agent-state.d.ts +8 -8
  8. package/dist/common/types/message.d.ts +6 -6
  9. package/dist/common/types/organization.d.ts +102 -0
  10. package/dist/common/types/organization.js +3 -0
  11. package/dist/common/types/organization.js.map +1 -0
  12. package/dist/common/types/usage.d.ts +2 -2
  13. package/dist/common/util/credentials.d.ts +2 -2
  14. package/dist/common/websockets/websocket-schema.d.ts +256 -256
  15. package/dist/index.js +9 -3
  16. package/dist/organization-context.d.ts +33 -0
  17. package/dist/organization-context.js +112 -0
  18. package/dist/organization-context.js.map +1 -0
  19. package/dist/slash-commands.d.ts +7 -0
  20. package/dist/slash-commands.js +21 -0
  21. package/dist/slash-commands.js.map +1 -0
  22. package/dist/utils/spinner.js +1 -1
  23. package/package.json +1 -1
  24. package/dist/common/__tests__/project-file-tree.test.d.ts +0 -1
  25. package/dist/common/__tests__/project-file-tree.test.js +0 -251
  26. package/dist/common/__tests__/project-file-tree.test.js.map +0 -1
  27. package/dist/common/json-config/__tests__/__snapshots__/stringify-schema.test.js.snap +0 -119
  28. package/dist/common/util/process-stream.d.ts +0 -7
  29. package/dist/common/util/process-stream.js +0 -162
  30. package/dist/common/util/process-stream.js.map +0 -1
  31. package/dist/readline.d.ts +0 -22
  32. package/dist/readline.js +0 -180
  33. package/dist/readline.js.map +0 -1
  34. package/dist/utils/__tests__/__snapshots__/background-process-manager.test.js.snap +0 -137
  35. package/dist/utils/__tests__/file-paths.test.d.ts +0 -1
  36. package/dist/utils/__tests__/file-paths.test.js +0 -37
  37. package/dist/utils/__tests__/file-paths.test.js.map +0 -1
  38. package/dist/utils/__tests__/path.test.d.ts +0 -1
  39. package/dist/utils/__tests__/path.test.js +0 -37
  40. package/dist/utils/__tests__/path.test.js.map +0 -1
  41. package/dist/utils/file-paths.d.ts +0 -9
  42. package/dist/utils/file-paths.js +0 -24
  43. package/dist/utils/file-paths.js.map +0 -1
  44. package/dist/utils/path.d.ts +0 -9
  45. package/dist/utils/path.js +0 -27
  46. package/dist/utils/path.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,19 +1,25 @@
1
1
  #!/usr/bin/env node
2
2
  process.env.NEXT_PUBLIC_CB_ENVIRONMENT = 'production';
3
3
  process.env.NEXT_PUBLIC_BACKEND_URL = 'manicode-backend.onrender.com';
4
- process.env.NEXT_PUBLIC_APP_URL = 'https://www.codebuff.com';
4
+ process.env.NEXT_PUBLIC_APP_URL = 'https://codebuff.com';
5
5
  process.env.NEXT_PUBLIC_SUPPORT_EMAIL = 'support@codebuff.com';
6
6
  process.env.NEXT_PUBLIC_POSTHOG_API_KEY = 'phc_tug7g8yc10qNestK14QV8WyKwjfEl6vwzIbJkBdqeHS';
7
7
  process.env.NEXT_PUBLIC_POSTHOG_HOST_URL = 'https://us.i.posthog.com';
8
8
  process.env.NEXT_PUBLIC_CB_ENVIRONMENT = 'production';
9
9
  process.env.NEXT_PUBLIC_BACKEND_URL = 'manicode-backend.onrender.com';
10
- process.env.NEXT_PUBLIC_APP_URL = 'https://www.codebuff.com';
10
+ process.env.NEXT_PUBLIC_APP_URL = 'https://codebuff.com';
11
11
  process.env.NEXT_PUBLIC_SUPPORT_EMAIL = 'support@codebuff.com';
12
12
  process.env.NEXT_PUBLIC_POSTHOG_API_KEY = 'phc_tug7g8yc10qNestK14QV8WyKwjfEl6vwzIbJkBdqeHS';
13
13
  process.env.NEXT_PUBLIC_POSTHOG_HOST_URL = 'https://us.i.posthog.com';
14
14
  process.env.NEXT_PUBLIC_CB_ENVIRONMENT = 'production';
15
15
  process.env.NEXT_PUBLIC_BACKEND_URL = 'manicode-backend.onrender.com';
16
- process.env.NEXT_PUBLIC_APP_URL = 'https://www.codebuff.com';
16
+ process.env.NEXT_PUBLIC_APP_URL = 'https://codebuff.com';
17
+ process.env.NEXT_PUBLIC_SUPPORT_EMAIL = 'support@codebuff.com';
18
+ process.env.NEXT_PUBLIC_POSTHOG_API_KEY = 'phc_tug7g8yc10qNestK14QV8WyKwjfEl6vwzIbJkBdqeHS';
19
+ process.env.NEXT_PUBLIC_POSTHOG_HOST_URL = 'https://us.i.posthog.com';
20
+ process.env.NEXT_PUBLIC_CB_ENVIRONMENT = 'production';
21
+ process.env.NEXT_PUBLIC_BACKEND_URL = 'manicode-backend.onrender.com';
22
+ process.env.NEXT_PUBLIC_APP_URL = 'https://codebuff.com';
17
23
  process.env.NEXT_PUBLIC_SUPPORT_EMAIL = 'support@codebuff.com';
18
24
  process.env.NEXT_PUBLIC_POSTHOG_API_KEY = 'phc_tug7g8yc10qNestK14QV8WyKwjfEl6vwzIbJkBdqeHS';
19
25
  process.env.NEXT_PUBLIC_POSTHOG_HOST_URL = 'https://us.i.posthog.com';
@@ -0,0 +1,33 @@
1
+ import { Client } from './client';
2
+ export interface OrganizationContext {
3
+ organizationId?: string;
4
+ organizationName?: string;
5
+ repositoryUrl?: string;
6
+ usingOrganizationCredits: boolean;
7
+ organizationBalance?: number;
8
+ userBalance?: number;
9
+ }
10
+ /**
11
+ * Determines organization context for the current project
12
+ */
13
+ export declare function getOrganizationContext(client: Client): Promise<OrganizationContext>;
14
+ /**
15
+ * Displays organization context information to the user
16
+ */
17
+ export declare function displayOrganizationContext(context: OrganizationContext): string;
18
+ /**
19
+ * Formats credit usage information with organization context
20
+ */
21
+ export declare function formatCreditUsage(creditsUsed: number, context: OrganizationContext): string;
22
+ /**
23
+ * Checks if user can override organization credit usage
24
+ */
25
+ export declare function canOverrideOrganizationCredits(context: OrganizationContext): boolean;
26
+ /**
27
+ * Gets organization-specific CLI commands
28
+ */
29
+ export declare function getOrganizationCommands(): Array<{
30
+ command: string;
31
+ description: string;
32
+ handler: () => Promise<void>;
33
+ }>;
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOrganizationContext = getOrganizationContext;
4
+ exports.displayOrganizationContext = displayOrganizationContext;
5
+ exports.formatCreditUsage = formatCreditUsage;
6
+ exports.canOverrideOrganizationCredits = canOverrideOrganizationCredits;
7
+ exports.getOrganizationCommands = getOrganizationCommands;
8
+ const logger_1 = require("./utils/logger");
9
+ const project_files_1 = require("./project-files");
10
+ /**
11
+ * Determines organization context for the current project
12
+ */
13
+ async function getOrganizationContext(client) {
14
+ try {
15
+ const repositoryUrl = await (0, project_files_1.getCurrentRepositoryUrl)();
16
+ if (!repositoryUrl) {
17
+ return {
18
+ usingOrganizationCredits: false,
19
+ };
20
+ }
21
+ // Check if this repository is associated with an organization
22
+ // This would typically be done via an API call to the backend
23
+ // For now, we'll implement a placeholder
24
+ const context = {
25
+ repositoryUrl,
26
+ usingOrganizationCredits: false,
27
+ };
28
+ // TODO: Implement API call to check organization association
29
+ // const orgInfo = await client.checkOrganizationForRepository(repositoryUrl)
30
+ // if (orgInfo) {
31
+ // context.organizationId = orgInfo.id
32
+ // context.organizationName = orgInfo.name
33
+ // context.usingOrganizationCredits = true
34
+ // context.organizationBalance = orgInfo.balance
35
+ // }
36
+ return context;
37
+ }
38
+ catch (error) {
39
+ logger_1.logger.error({ error }, 'Error getting organization context');
40
+ return {
41
+ usingOrganizationCredits: false,
42
+ };
43
+ }
44
+ }
45
+ /**
46
+ * Displays organization context information to the user
47
+ */
48
+ function displayOrganizationContext(context) {
49
+ if (!context.usingOrganizationCredits) {
50
+ return 'Using personal credits';
51
+ }
52
+ const parts = [];
53
+ if (context.organizationName) {
54
+ parts.push(`Organization: ${context.organizationName}`);
55
+ }
56
+ if (context.organizationBalance !== undefined) {
57
+ parts.push(`Org Credits: ${context.organizationBalance.toLocaleString()}`);
58
+ }
59
+ if (context.userBalance !== undefined) {
60
+ parts.push(`Personal Credits: ${context.userBalance.toLocaleString()}`);
61
+ }
62
+ return parts.join(' | ');
63
+ }
64
+ /**
65
+ * Formats credit usage information with organization context
66
+ */
67
+ function formatCreditUsage(creditsUsed, context) {
68
+ const baseMessage = `Used ${creditsUsed.toLocaleString()} credits`;
69
+ if (context.usingOrganizationCredits && context.organizationName) {
70
+ return `${baseMessage} (from ${context.organizationName})`;
71
+ }
72
+ return `${baseMessage} (personal)`;
73
+ }
74
+ /**
75
+ * Checks if user can override organization credit usage
76
+ */
77
+ function canOverrideOrganizationCredits(context) {
78
+ // Users can always fall back to personal credits if they have them
79
+ return context.userBalance !== undefined && context.userBalance > 0;
80
+ }
81
+ /**
82
+ * Gets organization-specific CLI commands
83
+ */
84
+ function getOrganizationCommands() {
85
+ return [
86
+ {
87
+ command: '/org-status',
88
+ description: 'Show organization credit status',
89
+ handler: async () => {
90
+ // TODO: Implement organization status display
91
+ console.log('Organization status not yet implemented');
92
+ },
93
+ },
94
+ {
95
+ command: '/org-switch',
96
+ description: 'Switch between personal and organization credits',
97
+ handler: async () => {
98
+ // TODO: Implement organization switching
99
+ console.log('Organization switching not yet implemented');
100
+ },
101
+ },
102
+ {
103
+ command: '/org-usage',
104
+ description: 'Show organization usage breakdown',
105
+ handler: async () => {
106
+ // TODO: Implement organization usage display
107
+ console.log('Organization usage display not yet implemented');
108
+ },
109
+ },
110
+ ];
111
+ }
112
+ //# sourceMappingURL=organization-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization-context.js","sourceRoot":"","sources":["../src/organization-context.ts"],"names":[],"mappings":";;AAgBA,wDAmCC;AAKD,gEAoBC;AAKD,8CAWC;AAKD,wEAGC;AAKD,0DA+BC;AAxID,2CAAuC;AACvC,mDAAyE;AAYzE;;GAEG;AACI,KAAK,UAAU,sBAAsB,CAAC,MAAc;IACzD,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,MAAM,IAAA,uCAAuB,GAAE,CAAA;QA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,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAC/B,WAAmB,EACnB,OAA4B;IAE5B,MAAM,WAAW,GAAG,QAAQ,WAAW,CAAC,cAAc,EAAE,UAAU,CAAA;IAElE,IAAI,OAAO,CAAC,wBAAwB,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;QACjE,OAAO,GAAG,WAAW,UAAU,OAAO,CAAC,gBAAgB,GAAG,CAAA;IAC5D,CAAC;IAED,OAAO,GAAG,WAAW,aAAa,CAAA;AACpC,CAAC;AAED;;GAEG;AACH,SAAgB,8BAA8B,CAAC,OAA4B;IACzE,mEAAmE;IACnE,OAAO,OAAO,CAAC,WAAW,KAAK,SAAS,IAAI,OAAO,CAAC,WAAW,GAAG,CAAC,CAAA;AACrE,CAAC;AAED;;GAEG;AACH,SAAgB,uBAAuB;IAKrC,OAAO;QACL;YACE,OAAO,EAAE,aAAa;YACtB,WAAW,EAAE,iCAAiC;YAC9C,OAAO,EAAE,KAAK,IAAI,EAAE;gBAClB,8CAA8C;gBAC9C,OAAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAA;YACxD,CAAC;SACF;QACD;YACE,OAAO,EAAE,aAAa;YACtB,WAAW,EAAE,kDAAkD;YAC/D,OAAO,EAAE,KAAK,IAAI,EAAE;gBAClB,yCAAyC;gBACzC,OAAO,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAA;YAC3D,CAAC;SACF;QACD;YACE,OAAO,EAAE,YAAY;YACrB,WAAW,EAAE,mCAAmC;YAChD,OAAO,EAAE,KAAK,IAAI,EAAE;gBAClB,6CAA6C;gBAC7C,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAA;YAC/D,CAAC;SACF;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,7 @@
1
+ export interface SlashCommand {
2
+ command: string;
3
+ description: string;
4
+ aliases?: string[];
5
+ fullCommand?: string;
6
+ }
7
+ export declare const slashCommands: SlashCommand[];
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.slashCommands = void 0;
4
+ exports.slashCommands = [
5
+ { command: '/help', fullCommand: 'help', description: 'Show help menu', aliases: ['/h'] },
6
+ { command: '/login', fullCommand: 'login', description: 'Authenticate your session' },
7
+ { command: '/logout', fullCommand: 'logout', description: 'Sign out of your session' },
8
+ { command: '/init', fullCommand: 'init', description: 'Configure project for better results' },
9
+ { command: '/diff', fullCommand: 'diff', description: 'Show last assistant change diff', aliases: ['/d'] },
10
+ { command: '/undo', fullCommand: 'undo', description: 'Revert to previous checkpoint', aliases: ['/u'] },
11
+ { command: '/redo', fullCommand: 'redo', description: 'Re-apply previously undone checkpoint', aliases: ['/r'] },
12
+ { command: '/checkpoint save', fullCommand: 'checkpoint save', description: 'Save current state as a new checkpoint' },
13
+ { command: '/checkpoint list', fullCommand: 'checkpoint list', description: 'List all saved checkpoints' },
14
+ { command: '/checkpoint clear', fullCommand: 'checkpoint clear', description: 'Clear all checkpoints' },
15
+ // For commands like "checkpoint <id>", direct slash command is tricky.
16
+ // User would type "/checkpoint restore" then space and the id.
17
+ { command: '/checkpoint restore', fullCommand: 'checkpoint restore', description: 'Restore to checkpoint <id> (type ID after)' },
18
+ { command: '/usage', fullCommand: 'usage', description: 'View remaining/bonus AI credits', aliases: ['/credits'] },
19
+ { command: '/exit', fullCommand: 'exit', description: 'Quit Codebuff', aliases: ['/quit', '/q'] },
20
+ ];
21
+ //# sourceMappingURL=slash-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slash-commands.js","sourceRoot":"","sources":["../src/slash-commands.ts"],"names":[],"mappings":";;;AAOa,QAAA,aAAa,GAAmB;IAC3C,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE;IACzF,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,WA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C"}
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.Spinner = void 0;
27
- const readline = __importStar(require("../readline"));
27
+ const readline = __importStar(require("readline"));
28
28
  const picocolors_1 = require("picocolors");
29
29
  const display_1 = require("../display");
30
30
  const chars = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codebuff",
3
- "version": "1.0.290",
3
+ "version": "1.0.291",
4
4
  "description": "AI dev assistant",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -1 +0,0 @@
1
- export {};
@@ -1,251 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- // @ts-ignore
30
- const bun_test_1 = require("bun:test");
31
- const path_1 = __importDefault(require("path"));
32
- const memfs_1 = require("memfs");
33
- // Mock fs to use memfs's vol directly
34
- bun_test_1.mock.module('fs', () => ({
35
- existsSync: (path) => memfs_1.vol.existsSync(path),
36
- readFileSync: (path, options) => memfs_1.vol.readFileSync(path, options),
37
- }));
38
- // Import fs after mocking to get the mocked version
39
- const fs_1 = __importDefault(require("fs"));
40
- const projectFileTreeModule = __importStar(require("../project-file-tree"));
41
- const project_file_tree_1 = require("../project-file-tree");
42
- // Basic memfs check
43
- (0, bun_test_1.it)('memfs basic check', () => {
44
- memfs_1.vol.reset();
45
- memfs_1.vol.fromJSON({ '/testfile.txt': 'content' });
46
- (0, bun_test_1.expect)(fs_1.default.existsSync('/testfile.txt')).toBe(true);
47
- (0, bun_test_1.expect)(fs_1.default.readFileSync('/testfile.txt', 'utf8')).toBe('content');
48
- });
49
- (0, bun_test_1.describe)('parseGitignore', () => {
50
- const projectRoot = '/project';
51
- (0, bun_test_1.it)('handles empty .gitignore', () => {
52
- memfs_1.vol.reset();
53
- memfs_1.vol.fromJSON({
54
- '/project/.gitignore': '',
55
- });
56
- const ig = (0, project_file_tree_1.parseGitignore)(projectRoot, projectRoot);
57
- (0, bun_test_1.expect)(ig.ignores('file.txt')).toBe(false);
58
- });
59
- (0, bun_test_1.it)('ignores comments and blank lines', () => {
60
- memfs_1.vol.reset();
61
- memfs_1.vol.fromJSON({
62
- '/project/.gitignore': `
63
- # This is a comment
64
-
65
- # Another comment
66
- `,
67
- });
68
- const ig = (0, project_file_tree_1.parseGitignore)(projectRoot, projectRoot);
69
- (0, bun_test_1.expect)(ig.ignores('file.txt')).toBe(false);
70
- });
71
- (0, bun_test_1.it)('handles simple file patterns', () => {
72
- memfs_1.vol.reset();
73
- memfs_1.vol.fromJSON({
74
- '/project/.gitignore': `
75
- file.txt
76
- *.log
77
- `,
78
- });
79
- const ig = (0, project_file_tree_1.parseGitignore)(projectRoot, projectRoot);
80
- (0, bun_test_1.expect)(ig.ignores('file.txt')).toBe(true);
81
- (0, bun_test_1.expect)(ig.ignores('debug.log')).toBe(true);
82
- (0, bun_test_1.expect)(ig.ignores('src/error.log')).toBe(true);
83
- (0, bun_test_1.expect)(ig.ignores('other.txt')).toBe(false);
84
- });
85
- (0, bun_test_1.it)('handles directory patterns', () => {
86
- memfs_1.vol.reset();
87
- memfs_1.vol.fromJSON({
88
- '/project/.gitignore': 'build/',
89
- });
90
- const ig = (0, project_file_tree_1.parseGitignore)(projectRoot, projectRoot);
91
- (0, bun_test_1.expect)(ig.ignores('build/output.js')).toBe(true);
92
- (0, bun_test_1.expect)(ig.ignores('src/build/output.js')).toBe(true);
93
- (0, bun_test_1.expect)(ig.ignores('building.js')).toBe(false);
94
- });
95
- (0, bun_test_1.it)('handles root-anchored patterns in root .gitignore', () => {
96
- memfs_1.vol.reset();
97
- memfs_1.vol.fromJSON({
98
- '/project/.gitignore': '/config.js',
99
- });
100
- const ig = (0, project_file_tree_1.parseGitignore)(projectRoot, projectRoot);
101
- (0, bun_test_1.expect)(ig.ignores('config.js')).toBe(true);
102
- (0, bun_test_1.expect)(ig.ignores('src/config.js')).toBe(false);
103
- });
104
- (0, bun_test_1.it)('handles root-anchored patterns in subdirectory .gitignore', () => {
105
- memfs_1.vol.reset();
106
- memfs_1.vol.fromJSON({
107
- '/project/src/.gitignore': '/config.js',
108
- });
109
- const ig = (0, project_file_tree_1.parseGitignore)(path_1.default.join(projectRoot, 'src'), projectRoot);
110
- (0, bun_test_1.expect)(ig.ignores('config.js')).toBe(true);
111
- (0, bun_test_1.expect)(ig.ignores('src/config.js')).toBe(false);
112
- });
113
- (0, bun_test_1.it)('handles negation patterns', () => {
114
- memfs_1.vol.reset();
115
- memfs_1.vol.fromJSON({
116
- '/project/.gitignore': `
117
- *.log
118
- !important.log
119
- `,
120
- });
121
- const ig = (0, project_file_tree_1.parseGitignore)(projectRoot, projectRoot);
122
- (0, bun_test_1.expect)(ig.ignores('debug.log')).toBe(true);
123
- (0, bun_test_1.expect)(ig.ignores('important.log')).toBe(false);
124
- });
125
- (0, bun_test_1.it)('handles patterns with leading/trailing whitespace', () => {
126
- memfs_1.vol.reset();
127
- memfs_1.vol.fromJSON({
128
- '/project/.gitignore': `
129
- \t file.txt \t
130
- \t *.log \t
131
- `,
132
- });
133
- const ig = (0, project_file_tree_1.parseGitignore)(projectRoot, projectRoot);
134
- (0, bun_test_1.expect)(ig.ignores('file.txt')).toBe(true);
135
- (0, bun_test_1.expect)(ig.ignores('debug.log')).toBe(true);
136
- });
137
- (0, bun_test_1.it)('handles .codebuffignore and .manicodeignore', () => {
138
- memfs_1.vol.reset();
139
- memfs_1.vol.fromJSON({
140
- '/project/.codebuffignore': 'codebuff.log',
141
- '/project/.manicodeignore': 'manicode.log',
142
- });
143
- const ig = (0, project_file_tree_1.parseGitignore)(projectRoot, projectRoot);
144
- (0, bun_test_1.expect)(ig.ignores('codebuff.log')).toBe(true);
145
- (0, bun_test_1.expect)(ig.ignores('manicode.log')).toBe(true);
146
- (0, bun_test_1.expect)(ig.ignores('other.log')).toBe(false);
147
- });
148
- (0, bun_test_1.it)('handles multiple ignore files in the same directory', () => {
149
- memfs_1.vol.reset();
150
- memfs_1.vol.fromJSON({
151
- '/project/.gitignore': 'git.log',
152
- '/project/.codebuffignore': 'codebuff.log',
153
- '/project/.manicodeignore': '!git.log', // Should not un-ignore git.log
154
- });
155
- const ig = (0, project_file_tree_1.parseGitignore)(projectRoot, projectRoot);
156
- (0, bun_test_1.expect)(ig.ignores('git.log')).toBe(true);
157
- (0, bun_test_1.expect)(ig.ignores('codebuff.log')).toBe(true);
158
- });
159
- (0, bun_test_1.it)('handles Windows-style backslashes', () => {
160
- memfs_1.vol.reset();
161
- memfs_1.vol.fromJSON({
162
- '/project/.gitignore': 'src\\build\\output.js',
163
- });
164
- const ig = (0, project_file_tree_1.parseGitignore)(projectRoot, projectRoot);
165
- (0, bun_test_1.expect)(ig.ignores('src/build/output.js')).toBe(true);
166
- });
167
- (0, bun_test_1.it)('handles patterns relative to subdirectory .gitignore', () => {
168
- memfs_1.vol.reset();
169
- memfs_1.vol.fromJSON({
170
- '/project/src/.gitignore': 'build/',
171
- });
172
- const ig = (0, project_file_tree_1.parseGitignore)(path_1.default.join(projectRoot, 'src'), projectRoot);
173
- (0, bun_test_1.expect)(ig.ignores('src/build/output.js')).toBe(true);
174
- (0, bun_test_1.expect)(ig.ignores('build/output.js')).toBe(false);
175
- });
176
- (0, bun_test_1.it)('calls fs.existsSync and fs.readFileSync for each ignore file', () => {
177
- memfs_1.vol.reset();
178
- memfs_1.vol.fromJSON({
179
- '/project/.gitignore': 'git.log',
180
- '/project/.codebuffignore': 'codebuff.log',
181
- });
182
- const existsSpy = bun_test_1.mock.spyOn(fs_1.default, 'existsSync');
183
- const readSpy = bun_test_1.mock.spyOn(fs_1.default, 'readFileSync');
184
- (0, project_file_tree_1.parseGitignore)(projectRoot, projectRoot);
185
- // Should check for all three possible ignore files
186
- (0, bun_test_1.expect)(existsSpy).toHaveBeenCalledTimes(3);
187
- (0, bun_test_1.expect)(existsSpy).toHaveBeenCalledWith(path_1.default.join(projectRoot, '.gitignore'));
188
- (0, bun_test_1.expect)(existsSpy).toHaveBeenCalledWith(path_1.default.join(projectRoot, '.codebuffignore'));
189
- (0, bun_test_1.expect)(existsSpy).toHaveBeenCalledWith(path_1.default.join(projectRoot, '.manicodeignore'));
190
- // Should read the two files that exist
191
- (0, bun_test_1.expect)(readSpy).toHaveBeenCalledTimes(2);
192
- (0, bun_test_1.expect)(readSpy).toHaveBeenCalledWith(path_1.default.join(projectRoot, '.gitignore'), 'utf8');
193
- (0, bun_test_1.expect)(readSpy).toHaveBeenCalledWith(path_1.default.join(projectRoot, '.codebuffignore'), 'utf8');
194
- existsSpy.mockRestore();
195
- readSpy.mockRestore();
196
- });
197
- });
198
- (0, bun_test_1.describe)('isFileIgnored', () => {
199
- const projectRoot = '/project';
200
- (0, bun_test_1.it)('aggregates ignore rules from parent directories', () => {
201
- memfs_1.vol.reset();
202
- memfs_1.vol.fromJSON({
203
- '/project/.gitignore': '*.log',
204
- '/project/src/.gitignore': 'build/',
205
- '/project/src/frontend/.gitignore': '*.min.js',
206
- });
207
- const parseGitignoreSpy = bun_test_1.mock.spyOn(projectFileTreeModule, 'parseGitignore');
208
- // Root .gitignore pattern
209
- (0, bun_test_1.expect)((0, project_file_tree_1.isFileIgnored)('debug.log', projectRoot)).toBe(true);
210
- (0, bun_test_1.expect)((0, project_file_tree_1.isFileIgnored)('src/error.log', projectRoot)).toBe(true);
211
- // src/.gitignore pattern
212
- (0, bun_test_1.expect)((0, project_file_tree_1.isFileIgnored)('src/build/output.js', projectRoot)).toBe(true);
213
- (0, bun_test_1.expect)((0, project_file_tree_1.isFileIgnored)('other/build/output.js', projectRoot)).toBe(false);
214
- // src/frontend/.gitignore pattern
215
- (0, bun_test_1.expect)((0, project_file_tree_1.isFileIgnored)('src/frontend/app.min.js', projectRoot)).toBe(true);
216
- (0, bun_test_1.expect)((0, project_file_tree_1.isFileIgnored)('src/frontend/app.js', projectRoot)).toBe(false);
217
- // Should call parseGitignore for each directory up to root
218
- (0, bun_test_1.expect)(parseGitignoreSpy).toHaveBeenCalledTimes(3);
219
- parseGitignoreSpy.mockRestore();
220
- });
221
- (0, bun_test_1.it)('handles root-anchored patterns in subdirectories', () => {
222
- memfs_1.vol.reset();
223
- memfs_1.vol.fromJSON({
224
- '/project/src/.gitignore': '/config.js',
225
- });
226
- (0, bun_test_1.expect)((0, project_file_tree_1.isFileIgnored)('config.js', projectRoot)).toBe(true);
227
- (0, bun_test_1.expect)((0, project_file_tree_1.isFileIgnored)('src/config.js', projectRoot)).toBe(false);
228
- });
229
- (0, bun_test_1.it)('handles negation patterns across directories', () => {
230
- memfs_1.vol.reset();
231
- memfs_1.vol.fromJSON({
232
- '/project/.gitignore': '*.log',
233
- '/project/src/.gitignore': '!important.log',
234
- });
235
- (0, bun_test_1.expect)((0, project_file_tree_1.isFileIgnored)('debug.log', projectRoot)).toBe(true);
236
- (0, bun_test_1.expect)((0, project_file_tree_1.isFileIgnored)('src/important.log', projectRoot)).toBe(false);
237
- });
238
- (0, bun_test_1.it)('handles multiple ignore files in the same directory', () => {
239
- memfs_1.vol.reset();
240
- memfs_1.vol.fromJSON({
241
- '/project/src/.gitignore': 'git.log',
242
- '/project/src/.codebuffignore': 'codebuff.log',
243
- '/project/src/.manicodeignore': 'manicode.log',
244
- });
245
- (0, bun_test_1.expect)((0, project_file_tree_1.isFileIgnored)('src/git.log', projectRoot)).toBe(true);
246
- (0, bun_test_1.expect)((0, project_file_tree_1.isFileIgnored)('src/codebuff.log', projectRoot)).toBe(true);
247
- (0, bun_test_1.expect)((0, project_file_tree_1.isFileIgnored)('src/manicode.log', projectRoot)).toBe(true);
248
- (0, bun_test_1.expect)((0, project_file_tree_1.isFileIgnored)('src/other.log', projectRoot)).toBe(false);
249
- });
250
- });
251
- //# sourceMappingURL=project-file-tree.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"project-file-tree.test.js","sourceRoot":"","sources":["../../src/__tests__/project-file-tree.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,aAAa;AACb,uCAAqD;AACrD,gDAAuB;AACvB,iCAA2B;AAE3B,sCAAsC;AACtC,eAAI,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;IACvB,UAAU,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,WAAG,CAAC,UAAU,CAAC,IAAI,CAAC;IAClD,YAAY,EAAE,CAAC,IAAY,EAAE,OAAY,EAAE,EAAE,CAAC,WAAG,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC;CAC9E,CAAC,CAAC,CAAA;AAEH,oDAAoD;AACpD,4CAAmB;AACnB,4EAA6D;AAC7D,4DAAoE;AAEpE,oBAAoB;AACpB,IAAA,aAAE,EAAC,mBAAmB,EAAE,GAAG,EAAE;IAC3B,WAAG,CAAC,KAAK,EAAE,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AA;QACX,WAAG,CAAC,QAAQ,CAAC;YACX,yBAAyB,EAAE,SAAS;YACpC,8BAA8B,EAAE,cAAc;YAC9C,8BAA8B,EAAE,cAAc;SAC/C,CAAC,CAAA;QAEF,IAAA,iBAAM,EAAC,IAAA,iCAAa,EAAC,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC5D,IAAA,iBAAM,EAAC,IAAA,iCAAa,EAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACjE,IAAA,iBAAM,EAAC,IAAA,iCAAa,EAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACjE,IAAA,iBAAM,EAAC,IAAA,iCAAa,EAAC,eAAe,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACjE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -1,119 +0,0 @@
1
- // Bun Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`stringifySchema should correctly stringify StartupProcessSchema 1`] = `
4
- "// Defines a single startup process.
5
- {
6
- // A user-friendly name for the process. Should be one word and unique.
7
- "name": string,
8
-
9
- // The actual shell command to execute.
10
- "command": string,
11
-
12
- // (optional): The working directory from which to run the command.
13
- "cwd": string | undefined,
14
-
15
- // (optional): Whether this process should be run, default: true
16
- "enabled": boolean | undefined,
17
-
18
- // (optional): Path to write the process's stdout. If not specified, stderr is not stored.
19
- "stdoutFile": string | undefined,
20
-
21
- // (optional): Path to write the process's stderr. If not specified, stderr will be put into the stdoutFile.
22
- "stderrFile": string | undefined
23
- }"
24
- `;
25
-
26
- exports[`stringifySchema should correctly stringify CodebuffConfigSchema 1`] = `
27
- "// Defines the overall Codebuff configuration file (e.g., codebuff.json). This schema defines the top-level structure of the configuration.
28
- {
29
- // (optional): Does nothing. Put any thing you want here!
30
- "description": any | undefined,
31
-
32
- // (optional): An array of startup processes.
33
- "startupProcesses": [
34
-
35
- // Defines a single startup process.
36
- {
37
- // A user-friendly name for the process. Should be one word and unique.
38
- "name": string,
39
-
40
- // The actual shell command to execute.
41
- "command": string,
42
-
43
- // (optional): The working directory from which to run the command.
44
- "cwd": string | undefined,
45
-
46
- // (optional): Whether this process should be run, default: true
47
- "enabled": boolean | undefined,
48
-
49
- // (optional): Path to write the process's stdout. If not specified, stderr is not stored.
50
- "stdoutFile": string | undefined,
51
-
52
- // (optional): Path to write the process's stderr. If not specified, stderr will be put into the stdoutFile.
53
- "stderrFile": string | undefined
54
- }
55
- ] | undefined
56
- }"
57
- `;
58
-
59
- exports[`stringifySchema should handle a more complex schema 1`] = `
60
- "// A complex test schema
61
- {
62
- // Unique identifier
63
- "id": string,
64
-
65
- // A positive integer count
66
- "count": number,
67
-
68
- // Activity status
69
- "isActive": boolean,
70
-
71
- // (optional): Optional list of tags
72
- "tags": [
73
-
74
- string
75
- ] | undefined,
76
-
77
- // A nested object structure
78
- "nested": {
79
- "value": string,
80
-
81
- // Nested configuration
82
- "config": {
83
- // (optional): Number of retries, default: 3
84
- "retries": number
85
- }
86
- }
87
- }"
88
- `;
89
-
90
- exports[`stringifySchema should handle an empty object schema 1`] = `
91
- "// An empty schema
92
- {
93
- }"
94
- `;
95
-
96
- exports[`stringifySchema should handle schema with only optional fields 1`] = `
97
- "// Schema with only optional fields
98
- {
99
- // (optional): Optional field 1
100
- "field1": string | undefined,
101
-
102
- // (optional): Optional field 2
103
- "field2": number | undefined
104
- }"
105
- `;
106
-
107
- exports[`stringifySchema should handle schema with default values 1`] = `
108
- "// Schema demonstrating default values
109
- {
110
- // (optional): Name with default, default: "anonymous"
111
- "name": string,
112
-
113
- // (optional): Level with default, default: 1
114
- "level": number,
115
-
116
- // (optional): Enabled with default, default: false
117
- "enabled": boolean
118
- }"
119
- `;
@@ -1,7 +0,0 @@
1
- export declare function processStreamWithTags<T extends string>(stream: AsyncGenerator<T>, tags: {
2
- [tagName: string]: {
3
- attributeNames: string[];
4
- onTagStart: (attributes: Record<string, string>) => void;
5
- onTagEnd: (content: string, attributes: Record<string, string>) => boolean;
6
- };
7
- }): AsyncGenerator<string, void, unknown>;